Run following command in console:
sed -i "s|\(APP_KEY=\)\(.*\)|\1$(openssl rand -base64 24)|" .env
This will update .env file with something like APP_KEY=foobar
While running following command
php artisan dusk
Gives the chrome binary not found error:
jaygaha@JGAHA:~/workspace/playground/laravel-dusk$ php artisan dusk
Assuming that Laravel Websockets has been already set up in backend.
Laravel Echo has everything you need for a separate Nuxt 3 front-end application. Let’s install the package with pusher js.
npm i laravel-echo pusher-js
Use the grant permissions command.
If your database name is "newdb" and user is "newuser" the command to grant all privileges on all the tables contained within would be:
mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
To get the query from an Eloquent call without actually running it, you can use the toSql()
method. This is useful when you only need to see the query and don't want to modify data. However, keep in mind that for complex queries or sub-queries, the toSql()
method may not display the entire query.
$users = User::query()
Both TIMESTAMP and DATETIME store date and time information, but they have some differences in terms of the range they support and the way they handle time zones.
Here are a few things to consider:
By default, the Laravel application skeleton does not include the lang
directory. If you would like to customize Laravel's language files or create your own, you should scaffold the lang
directory via the lang:publish
Artisan command. The lang:publish
command will create the lang
directory in your application and publish the default set of language files used by Laravel:
php artisan lang:publish
Create ja
directory inside lang
with en
directory. Copy the following files inside it.
While I was working on one of my projects using Laravel Sanctum using SPA Authentication. This project has multiple sub-domains for different environments, like DEV
, STG
, UAT
and is hosted in the same domain, like dev.domain.tld
, stg.domain.tld
. In the .env
file, the SESSION_DOMAIN
variable should include a leading dot (.) before the subdomain. This ensures that the session cookie is available to all subdomains. For example:
SESSION_DOMAIN=.domain.tld
sanctum/csrf-cookie
to initialize CSRF protection; it will set the session for the request and XSRF-TOKEN as a cookie in the browser. With this session, it will persist.