2017-01-11 10 views
1

Ich habe eine Arbeit an benutzerdefinierten Treiber in Laravel 5.2 erstellen. Mein Code ist hier unten.Wie zu beheben Fehler für Laravel 5.2

mein Auth.php hat

'providers' => [ 
    'users' => [ 
     'driver' => 'bootsgrid', 

    ], 

Und mein app.php haben

 App\Bootsgrid\Authentication\AuthServiceProvider::class, 

meine benutzerdefinierte Treiber-Controller unten dort

<?php 
namespace App\Bootsgrid\Authentication; 
use Auth; 
use App\Bootsgrid\Authentication\UserProvider; 
use Illuminate\Support\ServiceProvider; 
class AuthServiceProvider extends ServiceProvider 
{ 
/** 
* Perform post-registration booting of services. 
* 
* @return void 
*/ 
public function boot() 
{ 
    Auth::provider('bootsgrid', function($app, array $config) { 
     return new UserProvider(); 
    }); 
} 
/** 
* Register bindings in the container. 
* 
* @return void 
*/ 
public function register() 
{ 
    // 
} 
} 

Und mein Provider Datei dort

<?php 
namespace App\Bootsgrid\Authentication; 
use App\Bootsgrid\Authentication\User; 
use Illuminate\Contracts\Auth\UserProvider as IlluminateUserProvider; 



class UserProvider implements IlluminateUserProvider 
{ 

/** 
* @param mixed $identifier 
* @return \Illuminate\Contracts\Auth\Authenticatable|null 
*/ 
public function retrieveById($identifier) 
{ 
      // Get and return a user by their unique identifier 
} 
/** 
* @param mixed $identifier 
* @param string $token 
* @return \Illuminate\Contracts\Auth\Authenticatable|null 
*/ 
public function retrieveByToken($identifier, $token) 
{ 
    // Get and return a user by their unique identifier and "remember me" token 
} 
/** 
* @param \Illuminate\Contracts\Auth\Authenticatable $user 
* @param string $token 
* @return void 
*/ 
public function updateRememberToken(Authenticatable $user, $token) 
{ 

    // Save the given "remember me" token for the given user 
} 
/** 
* Retrieve a user by the given credentials. 
* 
* @param array $credentials 
* @return \Illuminate\Contracts\Auth\Authenticatable|null 
*/ 
public function retrieveByCredentials(array $credentials) 
{ 

    // Get and return a user by looking up the given credentials 
} 
/** 
* Validate a user against the given credentials. 
* 
* @param \Illuminate\Contracts\Auth\Authenticatable $user 
* @param array $credentials 
* @return bool 
*/ 
public function validateCredentials(Authenticatable $user, array $credentials) 
{ 
    // Check that given credentials belong to the given user 
} 
} 

Das ist alles mein Code, aber ich habe einen Fehler unterhalb dieser

Declaration of App\Bootsgrid\Authentication\UserProvider::updateRememberToken() must be compatible with Illuminate\Contracts\Auth\UserProvider::updateRememberToken(Illuminate\Contracts\Auth\Authenticatable $user, $token) 

ich weiß nicht, wie zu beheben it.please mir helfen.

+2

könnten Sie dies unter Ihre Namespace-Deklaration setzen: 'Illuminate \ Contracts \ Auth \ Authenticatable;' verwenden. Wenn das nicht behoben ist, bin ich sehr interessiert, was passiert – Loek

+0

ya es behoben. Ich bin sehr glücklich zu sagen, vielen Dank – murugesh

+0

Ich werde als Antwort hinzufügen, damit Sie es akzeptieren können :) – Loek

Antwort

3

Setzen Sie dies unter Ihre Namespace-Deklaration: use Illuminate\Contracts\Auth\Authenticatable;.

+0

Vielen Dank –