I have made a custom login system in laravel. This is my controller file.
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
class Front extends Controller {
public function register() {
if (Request::isMethod('post')) {
User::create([
'name' => Request::get('name'),
'email' => Request::get('email'),
'password' => bcrypt(Request::get('password')),
]);
}
return Redirect::away('login');
}
public function authenticate() {
if (Auth::attempt(['email' => Request::get('email'), 'password' => Request::get('password')])) {
return redirect()->intended('checkout');
} else {
return view('login', array('title' => 'Welcome', 'description' => '', 'page' => 'home'));
}
}
public function login() {
return view('auth/login', array('page' => 'home'));
}
public function checkout() {
return view('/aboutme', array('page' => 'home'));
}
}
And the routes are:
// Authentication routes...
Route::get('auth/login', 'Front@login');
Route::post('auth/login', 'Front@authenticate');
Route::get('auth/logout', 'Front@logout');
// Registration routes...
Route::post('/register', 'Front@register');
Route::get('/checkout', [
'middleware' => 'auth',
'uses' => 'Front@checkout'
]);
the error i am getting is:
FatalErrorException in Front.php line 12: Class 'App\Http\Controllers\Request' not found
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire