Answers for "laravel sanctum stable version"

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

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

laravel sanctum stable version

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

laravel sanctum

use Laravel\Sanctum\PersonalAccessToken as SanctumPersonalAccessToken;

class PersonalAccessToken extends SanctumPersonalAccessToken
{
    // ...
}
Posted by: Guest on July-24-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language