Skip to content

Tag: laravel

How to use a custom model’s method as property in Laravel 9?

In Laravel 9 I use Blade and Spatie´s Permisisons for authorisation. In addition I redirect admins to other Controllers / Layouts / Views than I redirect normal users to. With that approach I use the users table for both, admins and users. But users have a second table called clients with special normal user´…

fill already available values into CRUD edit form in Laravel

Let’s say, I have a Laravel application with articles which can have several tags associated (i.e. an n:m relation). Creating those records is working pretty fine and I can also retrieve the selected tags array. All the necessary relations are available and working in Eloquent or in the models. Now, I w…

Running Laravel anonymous migrations in Orchestra Test Bench

When doing testing in Orchestra Test Bench I often need to interact with the DB. It used to be that in your TestCase you would run this: Since Laravel 9 (I believe), there are now anonymous migrations which as their name implies, don’t have class names. So the above method doesn’t work. Thankfully…