Posts

Showing posts with the label Project

Laravel API With Sanctum

Image
  Laravel API With Sanctum Install a Laravel project           composer create-project laravel/laravel [my-project-name] Install the package           Composer require laravel/sanctum Do the migration           php artisan vendor:publish --provider=”Laravel\Sanctum\SanctumServiceProvider”  php artisan migrate Replace the kernel.php -> middlewareGroups -> api 'api' => [     \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,     'throttle:api',     \Illuminate\Routing\Middleware\SubstituteBindings::class, ], Add this to User model           use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable;} Add this to api.php routes           Route::group(['middleware' => ['auth:sanctum']], function () { Route::get('/emp...

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 ;               // Res...

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!!!