Anyone facing this error: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes. While running the migration, you need to add this line in AppServiceProvider in boot function: Schema::defaultStringLength(191); Don't forget to import the namespace for Schema
run command: composer require laravel/sanctum php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider" Add this line to your Api.php Route::group([ 'namespace' => 'App\Http\Controllers\Api', ], function ($router) { Route::post('login', 'AuthController@login'); Route::post('register', 'AuthController@register'); Route::post('logout', 'AuthController@logout'); }); did not show in the video
Just a tip, put on some background music at a low volume and don't talk too close to the microphone
Thanks you for suggestion ❤
Anyone facing this error:
Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes.
While running the migration, you need to add this line in AppServiceProvider in boot function:
Schema::defaultStringLength(191);
Don't forget to import the namespace for Schema
when I make a request via post man on register endpoint, it returns a 500 response(Internal Server Error)
run command:
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
Add this line to your Api.php
Route::group([
'namespace' => 'App\Http\Controllers\Api',
], function ($router) {
Route::post('login', 'AuthController@login');
Route::post('register', 'AuthController@register');
Route::post('logout', 'AuthController@logout');
});
did not show in the video
give me the css for login page
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !localStorage.getItem('token')) {
next({ name: 'login' });
} else if (to.meta.requiresAuth === false && localStorage.getItem('token')) {
next({ name: 'admin' });
} else {
next(); // Continue with the navigation
}
});
Thanks ,