Laravel TimeZone not working
I am using Lumen framework. How can I change Timezone to Europe/Paris CEST?
I added a variable in my .env file:
APP_TIMEZONE=Asia/Jakarta
here it's
If you want to manage your timezone from .env file, then you can add below code in your config.php file.
'timezone' => env('APP_TIMEZONE', 'UTC'),
and add the below line in your .env file.
APP_TIMEZONE='Asia/Jakarta'
Remove “api” Prefix from URL on Laravel
PHP Laravel Framework makes it easy for us to create a Restful API. We just set the routing in the Routes -> api.php section.
By default we will find that we will be given a url like this http://ourdomain.com/api/[end-point]
This is to distinguish between urls that can be accessed via the web or can only be accessed through api. We want to change it to http://ourdomain.com/[end-point] by removing the “api” prefix.
To change it we just go to the RouteServiceProvider.php file in the app/Providers folder
Then in the mapApiRoutes method function section, we can eliminate the prefix (‘api’)
#source : https://medium.com/@arthajonar/remove-api-prefix-from-url-on-laravel-35ed585f3a53
Add Public to asset path in Laravel
I want to install laravel in shared hosting and I followed the steps here https://stackoverflow.com/a/28449523 but my asset path doesn't include the public directory
Instead of this
<link href='http://example.com/public/assets/css/style.css' type='text/css' media='all' />
I'm getting this
<link href='http://example.com/assets/css/style.css' type='text/css' media='all' />
How do I change the directory of the asset folder(add public to assets) without changing any core classes?
Add ASSET_URL=public in your .env file and run php artisan config:cache
Livewire 3 Customizing the asset URL / Livewire3 is not working without PHP artisan serve
You can try reference the livewire assests from AppServiceProvider.php
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Illuminate\Support\Facades\Route;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
Livewire::setScriptRoute(function ($handle) {
return Route::get('/example-app/livewire/livewire.js', $handle);
});
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/example-app/livewire/update', $handle);
});
}
}
Livewire is not working without PHP artisan serve
First of all you should publish livewire configurational file with next command:
php artisan livewire:publish --config
Then in config folder you would be able to find file htdocs\YourProjectName\config\livewire.php where you would be able to edit the next string:
'asset_url' => null,
to
'asset_url' => 'http://localhost/YourProjectName/public',
And it should work after that. At least it worked in my case.
Docs: https://laravel-livewire.com/docs/2.x/installation
But in docs that string is called:
'asset_base_url' => '/assets'
instead of
'asset_url' => 'http://localhost/YourProjectName/public',
But in the end it doesn't matter;)
https://stackoverflow.com/questions/65370458/livewire-is-not-working-without-php-artisan-serve
https://github.com/livewire/livewire/issues/84