WernerACT
Deployment in a subfolder with Laravel and Filament PHP on shared hosting
I have build a simple property management application using Laravel 11 and Filament v3.
I deployed the application in two places. Both on shared hosting. The only difference is one is deployed under a subdomain under public_html.
So both applications are working one on is accessible on for example https://exampledomain.com and the other on https://testdomain.com/subfolder
I can load the login page on both but the second on https://testdomain.com/subfolder only works if I delete the routes cache. If the route is cached and I load https://testdomain.com/subfolder, I get an error stating
Method Not Allowed
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for route /. Supported methods: HEAD.
When I delete the route cache the login page loads.
The main issue is when I put in my login details on the second domain with the route cached deleted I get an error saying
Method Not Allowed
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The POST method is not supported for route user/login. Supported methods: GET, HEAD.
I have edit the .htaccess file
RewriteEngine On
RewriteBase /subfolder/
I have the below routes in my web.php file
<?php
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return redirect('/user/login');
})->name('home');
Route::get('/clear-cache', function() {
Artisan::call('config:clear');
Artisan::call('route:clear');
Artisan::call('cache:clear');
Artisan::call('view:clear');
return 'Done';
})->name('clear-cache');
Route::get('/cache', function() {
Artisan::call('filament:optimize');
Artisan::call('optimize');
return 'Done cache';
})->name('cache');
I have cleared routes, cache and views with no luck. Exact same project works perfectly on https://exampledomain.com without the subfolder
Any suggestions?
6 replies
Send a simple email after a resource is created
Hi all, I am new to the laravel and filament community and I have managed to create a new notification php artisan make:notification TicketCreatedNotification
How do I send this notification after a new Ticket resource is created.
Looking online they refer to Filament methods afterCreate() and afterSave(), but when I try and implement these suggestions I get an error that the methods do not exist,
For example:
public static function form(Form $form): Form
{
return $form
->schema([
// ... your fields
])
->afterCreate(function ($record, $data) {
$record->notify(new TicketCreatedNotification($record));
});
}
18 replies