Skip to main content

Laravel Policy and Gate

 1. Create a new Laravel project

> composer create-project laravel/laravel learn-policy-and-gate


navigate to the project

> cd learn-policy-and-gate

then open the code editor

> code .


2. In code editor, please open the .env file and adjust the database name and password

3. Open the terminal (ctrl + `) then run the migration

> php artisan migrate

If you don't have the database in your local yet, you'll likely get this kind of warning

`The database 'learn_policy_gate' does not exist on the 'mysql' connection.`

Choose yes in `Would you like to create it?` section to create the db first


The laravel application is ready, do `php artisan serve` and open the given url (http://127.0.0.1:8000) into your browser to verify

your app is working perfectly


Comments