· laravel · 2 min read
Day 4: Building a SaaS with Laravel
Let's start with Filament!
Before playing with Filament, I want to do some stuff
Task 1: Improve the mail template for the verification email
For that I used a free email template from mailmeteor;
and adapt where it needed in my blade view
<a href="{{$signedUrl}}" target="_blank"tyle="...">Confirm now</a>
I first used the :href=“$signedUrl” but it wasn’t working, so went back to that way.
It wasn’t easy to find “free” email template that are not full of images or too complex … :) If anyone have a website for that I’m interested.
Task 2: Save a cookie when you register and display a different page then.
Right now, when you put your email, it just show an alert to confirm, clear the text, and show you the input again.
I want to add a cookie so I know you register already and display a different text.
The way to create the cookie (yay with a queue!)
Cookie::queue('register', 'whatever', 60 * 24 * 30 * 12);
... in blade file
@if (!Cookie::get('register') && !session()->has('success'))
<span>Show the form<span>
@else
<span>Show thank you register<span>
@endif
Task 3: Install Laravel Seo package
composer require archtechx/laravel-seo
then for now I just did something like this in my homepage:
seo()
->title(App::environment('APP_ENV') == 'local' ? '[DEV] DetectAny - Home' : 'DetectAny - Home')
->description('Detect Anything in an image, a video, a text, a sound, ... Coming Soon')
->image(asset('images/detectany.jpg'))
->url(url()->current());
Super simple and working perfectly -_-
Task 4: Install Filament!
Finally the goal of the day!
I think Filament is the “package” that make me wow Laravel! And I must say now that I’m using it I’m very must wow.
I had some issue in PHPStorm after installing Filament (quite weird) but just restarting PHPStorm solve the error.
But then I follow the “Get Started” from Filament and I create my first filament user, set the rules on my User model.
I mainly did some test and create an interface to manage the newsletter users in just like … 30 secondes!
Release command to deploy scripts in fly.io
Instead of using a release command where you can only put one command - i’ve created a script that I put inside
.fly/scripts/other.sh
...
#!/usr/bin/env bash
echo "Running other.sh"
/usr/bin/php /var/www/html/artisan migrate --force
/usr/bin/php /var/www/html/artisan icons:cache #For Filament.
I thought it was not working because I couldn’t see any logs in my github action log but in fact you have to launch
flyctl logs