2015-02-12 13:56:47 +01:00
|
|
|
<?php namespace App;
|
|
|
|
|
2015-02-18 18:13:47 +01:00
|
|
|
use Illuminate\Auth\Authenticatable;
|
2015-02-12 13:56:47 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2015-02-18 18:13:47 +01:00
|
|
|
use Illuminate\Auth\Passwords\CanResetPassword;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
|
|
|
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
2015-02-17 15:56:30 +01:00
|
|
|
use Auth;
|
2015-02-12 13:56:47 +01:00
|
|
|
|
2015-02-18 18:13:47 +01:00
|
|
|
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
|
|
|
|
use Authenticatable, CanResetPassword;
|
2015-02-12 13:56:47 +01:00
|
|
|
|
|
|
|
protected $table = 'users';
|
|
|
|
|
2015-02-18 18:40:00 +01:00
|
|
|
public $timestamps = false;
|
2015-02-18 18:13:47 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = ['name', 'email', 'password'];
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes excluded from the model's JSON form.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $hidden = ['password', 'remember_token'];
|
2015-02-12 13:56:47 +01:00
|
|
|
|
2015-02-17 15:56:30 +01:00
|
|
|
public function scopeCurrent($query)
|
|
|
|
{
|
2015-02-18 23:15:18 +01:00
|
|
|
$idUser = Auth::user()->id;
|
|
|
|
return $query->where('id', $idUser)->first();
|
2015-02-17 15:56:30 +01:00
|
|
|
}
|
2015-02-12 13:56:47 +01:00
|
|
|
|
2015-02-17 15:56:30 +01:00
|
|
|
public function scopeReferents($query)
|
|
|
|
{
|
2015-02-17 22:39:53 +01:00
|
|
|
return $query->where('droits', '0');
|
2015-02-17 15:56:30 +01:00
|
|
|
}
|
2015-02-12 13:56:47 +01:00
|
|
|
}
|