· laravel · 2 min read

Day 6: Let's create the base

So much new stuff to learn and to understand ... it's fantastic and overwhelming at the same time :)

FilamentPHP

I’m very impressed with the capabilities of FilamentPHP; it makes me feel a bit like when I discovered Sanity.io for the first time. I was really impressed by the kind of “headless CMS” you could create with just some config file.

But here we are on another level -_- Another level from the author of Filament, and another level by the people making plugins for it!

I’ve spent 2 weeks reading the doc of PHP/Laravel, but I think I can spend another 2 weeks to read the one of Filament :)

I’ve used this code editor plugin which is not on the Filament plugin page (I tried the one on the Filament page, but it was a bit buggy).

Issue 1: Modified the database table but forgot the fillable …

Not fillable

Not an easy error to track - I tried to create a new “Detection” item, but it says that it was empty.

Issue 2: My images are not displayed correctly in FilamentPHP.

APP_URL was not configured correctly in my .env file.

I also ran

php artisan storage:link

But I’m not sure it’s 100% necessary as I found this in a Tricks page of Filament v2.

SaaS-wise

Today I focused on creating the base model and making the ability to upload a file / display that file.

Detections List

I’ve also looked into how to display something in the menu / have access to a resource if having a specific role - I can simply add this condition in my resource - I’ve seen they have plugins to have a more configurable way (spatie and shield) - not sure if I’ll need this first.

public static function canViewAny(): bool
{
  return auth()->user()->role == 'admin';
}
Back to Blog