Right now all my #php packages have 855 downloads in total. Which compared to other packages is like nothing. But 1000 people downloading and some of them still using my open source work is a cool feeling. Will pop open a beer once I reached my first 1000
I think in English when you write formal text you spell the numbers until 10. From there on you just write the number. #Laravel can help with that using the 'Number::spell' helper.
TIL that #Statamic ships with the 'isCpRoute()' function, which allowed me to make my code a little more compact. The function will check if the current route is a control panel route or not. Here's the old and new code. Feels refreshing 😁
The last few days I've shown some examples of how I use macros in #Laravel for certain classes in my daily work. In case you enjoy using macros as much as I do, here's a list of some popular and frequently used classes that implement the Macroable trait that you might not yet have on your radar.
Just published a new release of one of my #Statamic addons. But first I rewrote the whole thing, then updated the README, noticed that half of my code is not necessary, rewrote the whole thing, then updated the README again. That's how I work.
Recently a friend of mine pointed me towards HTTPie, a currently free Postman alternative which feels quite similar but less bloated. Also, besides the desktop app they've built a CLI client supporting form submissions and what not which is super fun to use. I personally prefer working with UIs in most cases but judging from GitHub with 32k stars as of today there might be some folks that feel a little different about the CLI topic.
I've worked on a new release of my 'restrict' addon for @statamic. Since v0.4.x you can define which entries should be listable to whom in the control panel by defining your custom restriction logic. Bring your own permissions, only show entries that belong to the same company as the user and what not.
However, my approach on achieving this still feels a bit shaky. So feel free to take a look at the repo and bring in your thoughts. Every hint is appreciated!
Oh man, there are so many #HTML tags I didn't know about. One of those is the <abbr> tag that can be useful when working with abbreviations. Here's a short example.
Macros are one thing I enjoy using the most in #Laravel. It's a way to extend the functionality of many built-in #Facades by providing custom callbacks for a specific key.
One production example I use macros for fairly often is what I call the "admin alert". Especially in smaller applications I want to get notified whenever an error or an event occurs the admin (mostly that's me) should know about.
Here's another interesting #HTML tag. <mark> lets you highlight certain parts of your text to draw extra attention to it.
One real world example where this can be especially useful is highlighting the parts of your search results that match the search query. Or at least that's where I regularly use it.
Do you know the #HTML tags 'details' and 'summary'? I didn't until now.
The combination of those two let's you toggle content with default HTML behavior. This is one of those things you will probably not use in production because it just doesn't look so nice but as always, for quickly prototyping something like an FAQ section this might just fit in perfectly.
@lyokolux Nothing and you’re absolutely right! I just don’t like the little arrow, it looks a bit „old“ I think but that definitely is not a deal breaker for sure. Maybe you can even change the arrow? Don’t know
Using global query scopes for simple one-to-many tenancy.
Code example of a #Laravel cat pension #SaaS app I've started and never finished. It's structured like this:
A user belongs to a pension
A pension has many clients
A client has many animals
Users (cat pension owners and their employees) can only view clients and animals from the same pension. Global query scopes ensure this rule is consistently applied throughout the app without accidentally forgetting it somewhere in your code.
When developing #Laravel applications I'm always a little afraid of sending emails to actual customers or placing real orders by accident. So I came up with a habit that works super well for me and maybe this will suit you as well.
In my /config/mail.php I add a 'developer' email address and ensure in my AppServiceProvider all emails are sent to this address when in non-production environments no matter what. Makes me build and test stuff way more confidently 😁
@rolfdenhartog That's a great solution, thanks! For such cases I usually work with Laravel Herd. However, many times I know my clients work with outlook for example and then I ensure everything looks fine in outlook. But still, your approach in general feels cleaner than adding my code snippet to the service provider.