Posts

Showing posts from October, 2021

Laravel API With JWT Authentication

Image
Laravel API With JWT Authentication   Create a new Laravel project        composer create-project laravel/laravel [my-project-name] Install JWT auth          composer require tymon/jwt-auth Go to the app->Models->User.php and update that user model         <?php           namespace App ;           use Tymon \ JWTAuth \ Contracts \ JWTSubject ;           use Illuminate \ Notifications \ Notifiable ;           use Illuminate \ Foundation \ Auth \ User as Authenticatable ;             class User extends Authenticatable implements JWTSubject           {               use Notifiable ;               // Rest omitted for brevity               /**                * Get the identifier that will be stored in the subject claim of the JWT.                *                * @return mixed                */               public function getJWTIdentifier ()               {                   return $this ->getKey();               }    

First Step to Laravel

Image
 First Step to Laravel First, you have to download the Xampp from the following link.           https://www.apachefriends.org/download.html Then go to the Xampp->php and copy the path and set it in environment variables Run php -v in the cmd and you will able to see the installed php version, Download the composer from below link and install,           https://getcomposer.org/ Run composer -v in cmd and you will be able to see the version of the composer you have installed Open a new command prompt and create your first Laravel project by executing the following command,          composer create-project laravel/laravel <your project name> Thank you!!!