Posts

Showing posts from November, 2021

Policies in laravel

Create policy using artisan command: 1. php artisan make:policy PostPolicy 2. php artisan make:policy PostPolicy --model=Post here PostPolicy is poilcy name and Post is model name

Laravel Seeders

Run Seeders 1. This command runs the Database\Seeders\DatabaseSeeder class, which may in turn invoke other seed classes: php artisan db:seed 2. --class option to specify a specific seeder class to run individually: php artisan db:seed --class=UserSeeder 3. Fresh Migrate and seed to delete all tables and recreate with data: php artisan migrate:fresh --seed Create Seeders 1. php artisan make:seeder seederclassname Example: php artisan make:seeder UserSeeder

How to authenticate request postman

Add header Authorization: Bearer token here

Personal access client not found. Please create one - RuntimeException laravel

php artisan passport:install

message \storage\oauth-private.key" does not exist or is not readable"

Run: php artisan passport:install This command will create the encryption keys needed to generate secure access tokens.This will create "personal access" and "password grant" clients which will be used to generate access tokens. php artisan passport:client --personal This command may be used to create your own clients for testing your auth functionality.