In this lesson, we will look at Laravel and Filament installation. You can skip this lesson if you already know how to install Laravel and Filament.
Laravel Installation
The simplest way to install Laravel is to follow the official documentation. We will use the Laravel installer to create a new project.
laravel new Filament-CRM-Course
This will generate a fresh Laravel installation in a Filament-CRM-Course
directory. You can change the name of the project to whatever you want.
Don't forget to set your database credentials in the .env
file.
Filament Installation
Next on our list is Filament. We will use Composer to install Filament.
composer require filament/filament
This will install the Filament package in your Laravel project. Next, we need to install Filament Panels:
php artisan filament:install --panels
Once that is done, we can visit our project in the browser like so:
http://filament-crm-course.test/admin/login
(don't forget to change the domain to match your project's domain)
Logging Into Filament
To log in, we need to create a user. But before we do that, Filament asks us to add FilamentUser
to our User Model:
app/Models/User.php
use Filament\Models\Contracts\FilamentUser;use Filament\Panel;use Illuminate\Foundation\Auth\User as Authenticatable; // ... class User extends Authenticatable implements FilamentUser{ // ... public function canAccessPanel(Panel $panel): bool { return true; // @todo Change this to check for access level }}
This is required for Filament to manage your User permissions and who can access the admin panel. We have set it to true
, allowing everyone to access the admin panel. We will change this later in this Course.
Next, we can define a simple admin user in our DatabaseSeeder.php
file:
database/seeders/DatabaseSeeder.php
public function run(): void{ User::factory()->create([ 'name' => 'Test Admin', 'email' => 'admin@admin.com', ]);}
Then run the migrations and seeders:
php artisan migrate --seed
And we should be able to log in with our admin user: (Email: admin@admin.com
, Password: password
)
That's it! We have Laravel and Filament configured and ready to go. In the next lesson, we will create our first Filament Resource - Customer
.
The php artisan filament:install --panels is giveing a error:
Sujestions ? Do I need to do all of them?
tryed to run php artisan filament:check-translations and got the following Error:
You have most likely installed V2 of filament and not V3. This guide required V3 version
Installed Livewire v3.0.8 then composer require filament/filament -W ./composer.json has been updated Running composer update filament/filament --with-all-dependencies Loading composer repositories with package information Updating dependencies Got Error:
Looks Like a versioning error to me
You do not have to install livewire as a separate package, it will come pre-bundled with FIlament. So only require Filament itself
Just do: composer require filament/filament
That gites me the 2.0.17 version
Which php version are you running? It should already give the v3
Had to change the php ini to alow the inil to work, I am using PHP 8.2.4 It has now installed and ready to go.
Hi, This guide required Filament V3 version https://filamentphp.com/docs/3.x/panels/upgrade-guide
Yes, this requires a V3, but your installation script has some problems. It should use:
composer require filament/filament
Adding
-W
is not a problem, but usually not required.Adding
--ignore-platform-req=ext-intl
is a problem as you can later break your application without even realising it.the back to top button in the bottom left is extremely annoying, it interfers with viewing pleasure. If you increase text-size it becomes even bigger.
Hi, are you talking about mobile view? If you could, please send us an email (mention that it's for Modestas in it) with a screenshot and we will take a look!
Is there any way you can do a few classes with the testing for this course?
In this course we did not plan to talk about testing. This is out of scope and not really a focus for these lessons.
x-filament::page> @foreach ($departments as $department) x-filament::section
Anyone using WSL2 facing issues running
composer require filament/filament
can follow here to install necessary PHP extensions. If you're using Laragon, you need to install it/enable it manually.