Laravel Useful Additions

February 2, 2023
Zacharias Creutznacher
Zacharias Creutznacher
Chief Technology Officer (CTO)

Sometimes you need certain functionality across multiple projects.

Here in our new laravel-useful-additions package we will share from time to time some traits and other functionalities we often use.

To install the package you'll only need to pull it via composer:

composer require laracraft-tech/laravel-useful-additions



Since PHP 8.1 we finally got enums! These functions can be very handy if you like to iterate through all of your enum types or you maybe want to use the enum as an array, for instance in a migration.



Select all columns but given excluded array.

Note: Since you can't do a native "select all but x,y,z" in mysql, we need to query (and cache) the existing columns of the table, and then exclude the given columns which should be ignored (not selected) by the query.

Cache: The existing column names of each table will be cached until contents of migrations directory is added or deleted. Modifying the contents of files inside the migrations directory will not re-cache the columns. Consider to clear the cache whenever you make a new deployment/migration!


Select all entries created today.


Select all entries created yesterday.


What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.




<span style="color:red;">asdfasdf</span>

composer require spatie/laravel-artisan-dispatchable

Setzen Sie Ihre Ideen um!
Heute ist der Tag, um das Geschäft Ihrer Träume aufzubauen. Teilen Sie Ihre Mission mit der Welt – und begeistern Sie Ihre Kunden.
Jetzt starten