I had made the routes in routes.php file
Route::controller('auth','Auth\AuthController');
Auth/AuthController.php file is
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use App\Http\Requests\Auth\LoginRequest;
use App\Http\Requests\Auth\RegisterRequest;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* the model instance
* @var User
*/
protected $user;
/**
* The Guard implementation.
*
* @var Authenticator
*/
protected $auth;
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct(Guard $auth, User $user)
{
$this->user = $user;
$this->auth = $auth;
$this->middleware('guest', ['except' => ['getLogout']]);
}
/**
* Show the application registration form.
*
* @return Response
*/
public function getRegister()
{
return view('auth.register');
}
/**
* Handle a registration request for the application.
*
* @param RegisterRequest $request
* @return Response
*/
public function postRegister(RegisterRequest $request)
{
//code for registering a user goes here.
$this->auth->login($this->user);
return redirect('/todo');
}
/**
* Show the application login form.
*
* @return Response
*/
public function getLogin()
{
return view('auth.login');
}
/**
* Handle a login request to the application.
*
* @param LoginRequest $request
* @return Response
*/
public function postLogin(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password')))
{
return redirect('/todo');
}
return redirect('/login')->withErrors([
'email' => 'The credentials you entered did not match our records. Try again?',
]);
}
/**
* Log the user out of the application.
*
* @return Response
*/
public function getLogout()
{
$this->auth->logout();
return redirect('/');
}
}
When I hit this auth/login it give me the error -- InvalidArgumentException in FileViewFinder.php line 137: View [auth.login] not found. Can anyone help me out to resolve this issue.?
Go to
bootstrap/cache
And rename config.php to config.php_
Im pretty sure you have copied from another site and moved also the cache
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