First clone the project and change the directory
git clone https://github.com/Rasel15827/laravel_sanctum.git
Then follow the process
- install the dependencies
composer install
- Copy
.env.example
to.env
cp .env.example .env
- Generate application key
php artisan key:generate
- Start the webserver
php artisan serve
That's mostly it! You have a fully running laravel installation with Sanctum, all configured.
You can start with Mysql by following these steps
-
Create a new Mysql database
-
Open your
.env
file and change the DATABASE options. -
Open
config\database.php
and change the mysql options. -
You can run both migrations and seeders together by simply running the following command
php artisan migrate:fresh --seed
OR
you can run them separately using the following commands
- Run Migrations
php artisan migrate:fresh
Now your database has essential tables for user, roles management and category.
- Run Database Seeders
Run db:seed
, and you have your first admin user, reguler user, some category, some essential roles in the roles table, and the relationship correctly setup.
php artisan db:seed