login()
возникли разногласия.public function login(Authenticatable $user, $remember = false)
{
\Sentinel::login($user, $remember);
}
SentinelAuthServiceProvider
в котором я регистрирую драйвер атунтификации. Но кажется я его создал излишне, но об это потом. Вот он:<?php
namespace App\Providers;
use Cartalyst\Sentinel\Laravel\SentinelServiceProvider;
use Illuminate\Support\ServiceProvider;
class SentinelAuthServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
\Auth::extend('sentinel', function($app) {
// Return an instance of Illuminate\Contracts\Auth\UserProvider...
return new SentinelUserProvider($app['sentinel.connection']);
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}
SentinelUserProvider
<?php
namespace App\Providers;
use App\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Support\ServiceProvider;
class SentinelUserProvider extends ServiceProvider implements UserProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
public function retrieveById($id){
return User::find($id);
}
public function retrieveByToken($identifier, $token){
return null;
}
public function updateRememberToken(Authenticatable $user, $token){
return null;
}
public function retrieveByCredentials(array $credentials){
return User::where($credentials)->first();
}
public function validateCredentials(Authenticatable $user, array $credentials){
return User::where($credentials)->first() == $user;
}
}
$app['sentinel.connection']
public function () {
return $this->hasMany('App\Client');
}
Route::get('test/{id}', function($id){
$user = User::find($id);
return $user->username;
});