I need a help . Can u guide me How can i Show a message to blocked user that his account has been blocked . i m just rendering him to post page . but i want to show him some message that your account has been blocked or somthing like we do in validation messages . Please guide briefly .
public function login(Request $request) { $username= $request->username;
$user = User::where('username',$username)->first();
// return $user;
// return $user->id;
if($user != null){
$active = Activation::whereUserId($user->id)->first();
if($active->completed==0){
return redirect('/posts');
}
You need to use session. One way to do that:
return redirect('posts')->with('error', 'Your account is blocked');
And in a view after redirection:
@if (session('error'))
{{ session('error') }}
@endif
If you don't want to redirect the user, just pass a variable into the view:
return view('login.form', ['notActivated' => $active->completed === 0])
And in the view:
@if ($notActivated)
Your account is blocked
@endif