Answers for "sanctum laravel"

PHP
1

laravel sanctum

Broadcast::routes(['middleware' => ['auth:sanctum']]);
Posted by: Guest on July-24-2021
0

laravel sanctum

composer create-project --prefer-dist laravel/laravel appname

composer require laravel/sanctum

php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"

composer require laravel/jetstream  
  
php artisan jetstream:install inertia                            

php artisan migrate  
  
npm install  

php artisan vendor:publish --tag=jetstream-views 

php artisan serve

npm run hot
Posted by: Guest on July-30-2021
1

laravel sanctum

return $user->createToken('token-name', ['server:update'])->plainTextToken;
Posted by: Guest on July-24-2021
0

sanctum laravel

composer require laravel/sanctum
Posted by: Guest on October-30-2020
1

laravel sanctum

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;

Route::post('/sanctum/token', function (Request $request) {
    $request->validate([
        'email' => 'required|email',
        'password' => 'required',
        'device_name' => 'required',
    ]);

    $user = User::where('email', $request->email)->first();

    if (! $user || ! Hash::check($request->password, $user->password)) {
        throw ValidationException::withMessages([
            'email' => ['The provided credentials are incorrect.'],
        ]);
    }

    return $user->createToken($request->device_name)->plainTextToken;
});
Posted by: Guest on February-16-2021
0

sanctum laravel

php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
Posted by: Guest on October-19-2020

Code answers related to "sanctum laravel"

Browse Popular Code Answers by Language