Laravel 5.2 PHP Build a social network - Middleware & Route Protection

preview_player
Показать описание
Build a complete Social Network Web Application with PHP Laravel. In this video you will learn how to apply middleware to routes and how to use it to make certain routes only accessible to authenticated users.

In this course we'll build a neat little social network and cover the basics of developing with Laravel.

See you in the videos!
Рекомендации по теме
Комментарии
Автор

Hey Max! I'm really happy to find your channel. You are an awesome teacher. These Laravel tutorials are fantastic and have helped a lot. I can't wait to dig into your Angular 2 stuff. I previewed it, feeling pretty excited.

For anyone who has issues with the Dashboard still being accessible it's more than likely because the Test Users you created at the beginning are still logged in. Because Max hasn't covered a Logout Session yet. For those who don't want to mess around with the Laravel code. Just delete all your test users from your MySQL database and you should see the Redirect work. Then you can create new test users as we go along. Cheers!!!

fragileglass
Автор

Lieber Maximilian, danke sehr fuer deine Tutorien!
Die sind so gut detaliert, dass man wirklich eine Menge davon lernen kann!

garikmelqonyan
Автор

For the guys having isses with Laravel 5.5.
i took a look at the docs, and here is the solution:
we have to add write the dashboard Route like this:

Route::get('/dashboard', [
'as' => 'dashboard',
])->middleware('auth');;

and also change the Route::group(['middleware' ..
name('home); to name('login');

Venessens
Автор

I am new to laravel and I must say that your videos are awesome and are easy to follow. Keep up the great job! You earned yourself a new subscriber :)

theDarkewave
Автор

Hahaha you have angular 2 on your mind.You are my new favourite teacher.It took me months to just get started with laravel. I started tonight and with other videos i nearly through my pc through window just by trying to install laravel. Thank you for great videos.Will buy your udemy course.

JacquesvanWyk
Автор

if after doing all this you still can access the dashboard page then you need to clear the cookies as the user session is already made when we tried to login earlier and we never logged out as we dont have that functionality yet.

Akbarkhan
Автор

'angular 2, I said it again!!', that makes me laugh every time :)
nice tutorial series.

AmirHossain_solid
Автор

Yes we will view all your videos!!You are great teacher...

_the_one_
Автор

Hey for making this kind of video...it is very very easy for beginners..Thanks a lot Max.!!

rajeshsingh-wrhl
Автор

what is for if we visit welcome page with login, this not redirecting to dashboard, because user already logged in they should not see the welcome page again

kamrul
Автор

I want to ask something rly basic, what if I want to redirect to a page without that 'uses' => 'blah blah blah' line, i dont get what it excactly does and what will happen if i dont use something like that. cuz when I creat a page and than try to create route for it and use that line, it basicly crashes and says: Method does not exist

agil-jn
Автор

Thanks for the tutorial :)
So for a multi-level user system I just need to define middlewares for filtering users' role (e.g. "admin" middleware filters user in 'admin' role) and put it in the specified routes. Ahh never thought about that.. I usually filter roles in action methods in the controller, which makes my controllers fat and ugly :D
and I just realized that 'web' middleware group is actually mandatory for web routes.

detaaditya
Автор

User is not redirected to dashboard view after successful sign up. what could be the problem ?

usaamatahir
Автор

Grate work Max really appreciate it. But I have one question about authentication. Why in this app are you not displaying an error message when logging authentication failed ? Thanks

dushynatpatel
Автор

Hey Guys, im using the newest version of Laravel (5.6.27) and i dont have the Authenticate.php file in my project tree. Maybe on the beggining it is optional and i have to create it somehow?

OloPK
Автор

what is the difference when you use inside route.php 'as' and '->name()'

NagatoKamiPain
Автор

for people using laravel 5.3 instead of trying to find the authenticate.php file go into app/Exceptions/Handler.php

once there scroll to the bottom and edit the bottom part into this

protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}

return redirect()->route('home');
}



also make sure your using web.php for routes instead of routes.php for laravel 5.3

ShahidFoy
Автор

Hmmm. I'm having a problem here. I followed your step exactly but when I added the 'middleware' => 'auth' I keep on getting redirected when I logged in - before it was working.

anthonydalechua
Автор

i can't protect my routes because am using laravel 5.3
i used the ''auth 'middleware in the Exceptions/Handle.php buh still not working
please help me

michaelquaynor
Автор

I have followed your steps. When I go for a signup, data got inserted in the database successfully, but it is not redirecting me to the Dashboard View. Will you please help me out? +Mindspace

ahmedqayyum