I am trying to use the inbuilt Auth
for login in laravel
and register. These automatically generated pages work so well, now I use Auth::guest()
to check if the user is authorized to return a view: index else to login page.
But it shows:
Class 'App\Http\Controllers\Auth' not found".
Here's the code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
class StepsController extends Controller
{
public function step1()
{
if (Auth::guest())
{
return redirect('login');
}else {
return view('index');
}
}
}