lundi 26 octobre 2015

using different table to authenticate user in laravel 5

I have created separate table called subscribers in mysql changed config/auth.php settings to 'model' => App\Subscribers::class, 'table' => 'subscribers'. I have login form on home page, that submits to the home page. so in routes i have below

Route::get('/', function () {
    return view('home');
});

Route::post('/', 'LoginController@validate');

my LoginController

namespace App\Http\Controllers;

use App\Http\Requests;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    public function validate()
    {
        // attempt to do the login
        $auth = Auth::attempt(
            [
                'email'  => strtolower(Input::get('email')),
                'password'  => Hash::make(Input::get('password'))
            ]
        );
        if ($auth) {
            return Redirect::to('dashboard');
        }

    }
}

when i login i get below error

Declaration of App\Http\Controllers\LoginController::validate() should be compatible with App\Http\Controllers\Controller::validate(Illuminate\Http\Request $request, array $rules, array $messages = Array, array $customAttributes = Array)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire