Laravel 8 E-Commerce - Admin and User Authentication
HTML-код
- Опубликовано: 3 ноя 2020
- In this video I will talk about Admin and User Authentication.
TOPIC DISCUSSED:
Admin and User Authentication
Jetstream Authentication
Create Middleware
Route Group
Create Admin and User Dashboard Page
Secure the Admin Route
Create Admin and User Dashboard Link
Create the Logout Link
Your Queries -
1.How to create admin and user authentication in laravel 8 e-commerce?
2.How to use jetstream authentication in laravel 8?
3.How to create middleware in laravel 8?
4.How to create route group in laravel 8?
5.How to secure admin route in laravel 8?
6.How to create logout link in laravel 8?
7.What are the steps for creating admin and user authentication in laravel 8 e-commerce?
Note:-
Please run the following command before running the application
npm install && npm run dev
Template Url:
github.com/surfsidemedia/Lara...
FOLLOW SURFSIDE MEDIA:
/ surfsidem
/ mediasurfside
github.com/surfsidemedia
/ surfsidemedia
#laravel #laravel8 #laravel8x Наука
Hola, a todos, y gracias por el contenido
min 33:30 aprox le faltó this a .closest
ejemplo.
@csrf
Cerrar sesión
Muchas gracias por tus tutoriales, saludos desde Perú
A mi me funcionó sin el this.
Que bueno ver a otro que habla español siguiendo este tutorial.
You are teaching every easy method..I am also a laravel developer.. I will definitely gonna try your method ..It wil take very few time and code to make admin registration form your method. I used to do it by creating $guard
if you are facing problem at time 9.36 click login button then you can try run command
npm install
npm run dev
hope that can help you
sir u have done a great Job! I'm looking forward to watching next video
Alhmadulillah this part done.. Thnx a lot
great job ... plz continue
Great job sir, thank you!
Great job sir, continue!
What are the extension you are using in Visual Studio Code for this project?
This was a great series and I love it. But I have some confusion:
1, Why not have the admin dashboard different like the way you did hospital appointment booking? Then users can stay on the website page why admin should go to a different dashboard with a different template for admin management!
How can I do such pls? After login, if the user type is ADM it will go to the admin dashboard different not staying on the website.
2, I was thinking if it will have something processing why submitting the form. It will give a better user experience to the application (Just like a dialog pop-up) after submitting it goes off and displays a success notification
Next tutorial please..
We're set for next lecture
Thanks
Thank you !!!!
You are the greate sir
thankyou sir!
Thank you Sir
thanks for your wonderful tutorial video. let me ask some question about error & how to solve.
3:38 POST error.
1. why laravel responded POST error.
2. How did you solve that problem?
I didn't understand that part.
please, give me advices. Thank you for your time.
great work, but you shouldn't edit anything inside the vendor folder otherwise whenever you run composer update it will overwrite any of your changes when the files update.
Great job sir, thank you!
You forgot this command line after installing jetstream : npm install && npm run dev"
Please a question.. How it's done??
I have an error because of that
@@lilasoscar6411 You can fix it
run comand
npm install
npm run dev
Done for me!
Done for me, thank you!
@@larvachannel7113 thank you so much
Good work so far....
Please can you provide the link for the playlist? I can't find the first video
Thanks for this tutorial.. I think changing and writing code in framework Vendor files does not right solution.. Can we handle instead of code that you change in vendor/laravel?
sir i also add namespace in AttemptToAuthinticate page
namespace Laravel\Fortify\Actions;
Symfony\Component\ErrorHandler\Error\FatalError
Namespace declaration statement has to be the very first statement or after any declare call in the script
C:\laravel_project\ecommercelaravel\vendor\laravel\fortify\src\Actions\AttemptToAuthenticate.php:2
@@santrawebtech35 We don't need to change anything in fortify vendor folder if we redirect both users to HOME page.
Should be some other place were we could add the session for middleware, other than this it's absolutely useless code added there, which will be anyway flushed after package update.
Thanks for beautefull tutorial fiends.
---> !!!!! In the workplace at the top right you have a button that collapses all folders and expands.
Thanks 🙏
THANK U
Sir is it necessary to put , Because we already mention it in the form action
Thank you again bro for this tutorial.
help me! Unable to locate a class or view for component [jet-validation-errors].
Great video :) :) . But we shouldn't change vendor. Solution for this case: in FortifyServiceProvider.php file, we add below code. It will be put user type into session
public function register(){
$this->app->instance(LoginResponse::class, new class implements LoginResponse{
public function toResponse(){
session(['user_type' => Auth::user()->user_type]);
return redirect()->route('home');
}
});
}
When I login as Admin and click on dashboard. It is redirecting me to the login page. Why does it happen??
does there any other way to overwrite the code in "fortify" package?
we can do this to not editing in vendor
if (Auth::user()->utype == 'ADM') {
return $next($request);
} else {
session()->flush();
return redirect()->route('login');
}
and we can use button type="submit" in form
You forgot this command line after installing jetstream : npm install && npm run dev"
Yes, sorry for that
@@SurfsideMedia sir please make video to restrict users login direct after registering otherwise waits for admin to approve them
@@SurfsideMedia after run npm still not working login and register
@@crick3570 npm run dev
@@crick3570
I also have the same problem and I've solved by using
npm install
npm run dev
The GET method is not supported for this route. Supported methods: POST. How to solve this?
AttempToAuthenticate.php is not in the project. How about Middleware\RedirectIfAuthenticated.php? Can you register 'ADM' session in there? Please help...
sir why these error occured within AttemptToAuthenticate page
Namespace declaration statement has to be the very first statement or after any declare call in the script
You can use instead of session: if( $request->user()->utype === 'ADM' )
thank you! :D
waiting next video
can someone help me after i input the code for login then i run the project it says the Vite manifest not found at: laravelecommerce\public\build/manifest.json i don't know how to fix that.
after I register or login is redirect to homepage not at dashboard page and there is not logout button for me to logout
I run npm and npm run dev then I got this:
added 765 packages, and audited 766 packages in 2m
72 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
> dev
> npm run development
> development
> mix
'webpack' is not recognized as an internal or external command,
operable program or batch file.
When I click on the login, it shows an error, when I click on the register it also shows an error. I don't know what to do again.
Pls help thank you.
Next tutorial plz :)
nice, when next video?
Thanks for the tutorial .
I get an error when I run npm install ,what is the problem? the error is like that
'npm' is not recognized as an internal or external command,
operable program or batch file.
first u need to install node js software and then try the command in project folder's command prompt. it worked for me.
please how to slove
Auth guard [:sanctum] is not defined.
For those who are facing this issue Route / is not defined after login from user or admin
Make sure this is added in your web.php
Route::get('/',HomeComponent::class)->name('/');
i do that but, i have this issue when I start the login Route [user/dashboard] not defined. (View: C:\xampp\htdocs\mitienda
esources\views\layouts\base.blade.php)
Same error please help
Laravel 8
nice
Hi... I am a beginner to Laravel. Route::middleware(['auth.sanctum','verified','authAdmin'])->group(function(){
Route::get('/admin/dashboard', AdminDashboardComponent::class)->name('admin.dashboard');
}); When I used above code, an error comes. It says Target class [auth.sanctum] does not exist. When I used below code It is working properly. Route::group(['middleware'=>'authAdmin'],function(){
Route::get('/admin/dashboard', AdminDashboardComponent::class)->name('admin.dashboard');
}); What is the issue with my coding? Which code segment should I use? Thank you....
I think you should be use Route::middleware(['auth.sanctum','verified','authadmin'])......... try it
Sir, I have a problem after registering it redirects to the dashboard not found I have to manually go back to see the registration
hi, but changing the code in vendor files is not right solution
Sir I tried following the tutorial to the fullest but it still doesn't open admin page or authenticate users it considers all users as non admin... pls can u help ?
Hello sir @auth @else not showing the login and register menu @endif without used @auth do show Login and register menu..why sir
Next Tutorials please....
The Mix manifest does not exist. (View: C:\xampp\htdocs\projectlaravel\ecommerce
esources\views\layouts\guest.blade.php)
I have an error when running this video clip. How do I fix it pls?
Great video sir
but i have this error Mix manifest not found at: C:\xampp\htdocs\Laravel\PenCalb\public\/mix-manifest.json.. i cant seem to find a way to solve it
Error
Undefined class constant 'HOME' pls. help me about this error
this video is wondered
Sir when click in logout then error ocur and said the get method is not support
The GET method is not supported for this route. Supported methods: POST.
Plz complete the project sir! Why have you stopped posting videos. I hope everything is fine.
Bonjour Mr j'essai de réaliser votre Tuto mais je suis bloqué sur cette erreur : Appel à la méthode non définie Illuminate\Support\Facades\Auth::extend() lorsque je clic sur le tableau de bord du login
avez-vous une solution pour moi ?
Hello Mr I am trying to make your Tutorial but I am stuck on this error: Call to the undefined method Illuminate\Support\Facades\Auth::extend() when I click on the login dashboard
do you have a solution for me?
The Mix manifest does not exist.
Missing Mix Manifest File
Did you forget to run `npm ci && npm run dev`?
Thank you for tutorial sir. But how solve this error?
Now i am facing a issue , when i try to access admin dashboard after logged in with admin credentials its again redirect to login page , please guide me how to fix it
sir i also add namespace in AttemptToAuthinticate page
namespace Laravel\Fortify\Actions;
New error menu navigation blade .php. Route not found exception ...
Error come when login successful and redirects to /home page with this error.
For both user and admin .... please give solution ....
Thank you for tutorial. But how solve "
Error exception
Array_key_exists(): The first argument should be either a string or an integer"
Thank you.
for this error i rewrite the handle method of my middleware AuthAdmin as this:
if(Auth::user()->utype === 'ADM') {
session(['utype'=>'ADM']);
return $next($request);
} else {
session()->flush();
return redirect(route('login'));
}
return $next($request);
}
my app run nice but I will know if it is a good code
Thank you
trying to do
Route::middleware(['auth:sanctum', 'verified','authadmin'])->group(function(){
Route::get('/admin/dashboard',AdminDashboardComponent::class)->name('admin.dashboard');
});
i get the message below :
array_key_exists(): The first argument should be either a string or an integer .
What is hapend?
You need a capital A in Admin. authAdmin
good
please, this project complete video upload
nead help
Target class [vartfied] does not exist.?
why?
CSS and JS doesn't work anymore after adding authentication
please give me a video on cart and checkout functions
could semone pleasae help me I get this error : Target class [verifiedauthadmin] does not exist.
I sepende more then 3 hours finding the solution but in vain
Hey guys help, after adding Jetstream I cannot see it's dashboard when I run the project?
Thanks I figured it our
did you run npm install in in cmd?? i am having trouble Missing Mix Manifest File
Install npm and run npm run dev or npm run prod
Yes, Please run this command npm install && npm run dev
@@SurfsideMedia I have an error when I start the page Route [user/dashboard] not defined. (View: C:\xampp\htdocs\mitienda
esources\views\layouts\base.blade.php)
Use below two
npm install
npm run production
if(Auth::user()->utype ==='ADM')
{
session(['utype'=>'ADM']);
return redirect(RouteServiceProvider::HOME);
}
else if(Auth::user()->utype ==='USR')
{
session(['utype'=>'ADM']);
return redirect(RouteServiceProvider::HOME);
} this code is not working at all in the attempttoautenticate file . The HOME is not being recognized. Do you know why?
I got this very same problem. If you found a solution please share
Class 'Laravel\Fortify\Actions\Auth' not found
show this error
Great tutorial best i have seen,
But please i have an error class "Laravel \Fortify\Action\Auth" not found. Please how do I go about it?
i have the same problem Error, Class 'Laravel\Fortify\Actions\Auth' not found
@@goldencoin369 just write use Auth; as import
@@creativeculture6119 unable to resolve with this also
I have the same problem sir , please someone help
I have the same problem anyone there to fixed the problem
admin/dashboard always redirecting to login page . why is that so?
Getting error Undefined constant "App\Http\Middleware\session"
can someone help me with this error:
throw new Exception("Mix manifest not found at: {$manifestPath}");
Symfony\Component\ErrorHandler\Error\FatalError
Namespace declaration statement has to be the very first statement or after any declare call in the script
C:\laravel_project\ecommercelaravel\vendor\laravel\fortify\src\Actions\AttemptToAuthenticate.php:2
please solve that error
Good Tutorial so far, but definitely not meant for beginners.
There are a couple of steps you skipped or forgot to include, which gives room for error.
Nevertheless, thanks for putting in the effort to create these tutorials.
Yes 2-3 error.....
Can u solve menu navigation Blade.php.... route not found exception.. after success login redirects with error
Sir after making of login and register page i found a issue of the mix manifest does not exist ..if anyone can solve my problem
I also have the same problem and I've solved by using
npm install
npm run dev
if someone ask where is auth code and how it works ?
I have a problem with the code when logging in as an administrator, it gives me the error Class "Laravel\Fortify\Actions\Auth" not found I am following the steps in video number 3
the line of code is
if(Auth::user()->utype ==='ADM')
{
session(['utype'=>'ADM']);
return redirect(RouteServiceProvider::HOME);
}
can you help me
Anyone had solution for this please reply thanks.
Thank you for the lessons! I'm from Ukraine. Very cool videos. In Russian, there seem to be no such. Thanks. Like and subscribe from me!
Спасабо за уроки! Я из Украины. Очень класные видео. На русском таких похоже нет. Спасибо. От меня лайк и подписка!
r u still alive?
how to make after admin login redirect to dashboard
Where can i find the url of the template used in this course
Check the description from the first video.
thanks Risky Saputra Siahaan
Class 'auth' not found (View: C:\xampp\htdocs\laravel8ecommerce
esources\views\layouts\base.blade.php)
please help
Hello sir, please i am getting this error "Missing Mix Manifest File", when clickig on the register or login link
npm install
npm run dev
I also have the same problem and I've solved by using
npm install
npm run dev
i can't link the file under resource folder for login and register. how to do?
Watch the video again and please retry
this tuto is nice when i submit login i facing error like Class 'Illuminate\Auth\Middleware\Auth' not found
add use Illuminate\Support\Facades\Auth; in class vendor\laravel\fortify\src\Actions\AttemptToAuthenticate
I also have similar error class "Laravel \Fortify\Action\Auth" not found. Please how do I go about it?
css & js is not loading ... can please suggst me somthing
hi. thanks for the tutorials. i have an error like this:
"Illuminate\Contracts\Container\BindingResolutionException"
Target class [authadmin] does not exist. "
and i think i get this errof from this code piece:
Route::middleware(['auth:sanctum', 'verified', 'authadmin'])->group(function ()
{
Route::get('admin/dashboard', AdminDashboardComponent::class)->name('admin.dashboard');
});
can anyone help me with this? thanks.
use App\Http\Middleware\AuthAdmin;
Route::middleware(['auth:sanctum', 'verified', AuthAdmin::class])->group(function ()
{
Route::get('admin/dashboard', AdminDashboardComponent::class)->name('admin.dashboard');
});
@@ebonyandruth ty i will try
i also have this error . u can help me . thanks!
@Surfside Media when i am trying to access the admin dashboard it is not redirecting to login page ??
Re-check the code in AuthAdmin Middleware file
@@SurfsideMedia Code is same but when I click at Admin Dashboard. It is redirecting to the login page directly.
@@bluemoon6988 check this line : if (session('utype') === 'ADM') {
@Surfside Media I have an error when I start the page Route [user/dashboard] not defined. (View: C:\xampp\htdocs\mitienda
esources\views\layouts\base.blade.php)
Please check routes on web.php file, may be mistakes in spellings and also check route name on base.blade.php file
Check your web.php file u not defined component
@@SurfsideMedia Yes, it was a line that was not commented on. I really appreciate your work and that you answered me, the way you explain and do the course is very methodical you are a good teacher, i hope you explain ways more pro to do multiauth.
Success and blessings
1000 Like
Next tutorial please sir
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The POST method is not supported for this route. Supported methods: GET, HEAD. How to fix it
i am facing the same problem, did you solved? if yes pls help me
Remove the title="Logout" in your