i have this error when user return from login to home page i can't understand what is it i am doing MultiAuth in laravel 5 and also help me if i can use login function and other registration function that is already available for users table i have no idea how to do that with already written functions
this is my login function
public function login()
{
$data = Input::all();
// Applying validation rules.
$rules = array(
'email' => 'required|email',
'password' => 'required|min:6',
);
$validator = Validator::make($data, $rules);
if ($validator->fails()){
// If validation falis redirect back to login.
return Redirect::to('admin/login')->withInput(Input::except('password'))->withErrors($validator);
}
else {
$userdata = array(
'email' => Input::get('email'),
'password' => Input::get('password')
);
}
// doing login.
if (Auth::validate($userdata)) {
if (Auth::attempt($userdata)) {
return Redirect::intended('admin');
}
}
else {
// if any error send back with message.
Session::flash('error', 'Something went wrong');
return Redirect::to('admin/login');
}
}
this is my AdminController
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class AdminController extends Controller
{
// public function __construct(){
//
// $this->middleware('admins');
// }
public function index(){
// $user = Auth::user();
// dd($user);
return view('admin.home');
}
}
Problem is in your namespace. In the Contrroller you have:
namespace App\Http\Controllers\Admin;
So the full name is:
App\Http\Controllers\Admin\AdminController;
and the error you get is:
App\Http\Controllers\AdminController;
You have to remove Admin from the ending of a namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With