This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
ModuleWeb/SRC/app/User.php

43 lines
1.0 KiB
PHP
Raw Normal View History

2015-02-12 12:56:47 +00:00
<?php namespace App;
2015-02-18 17:13:47 +00:00
use Illuminate\Auth\Authenticatable;
2015-02-12 12:56:47 +00:00
use Illuminate\Database\Eloquent\Model;
2015-02-18 17:13:47 +00:00
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
2015-02-17 14:56:30 +00:00
use Auth;
2015-02-12 12:56:47 +00:00
2015-02-18 17:13:47 +00:00
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword;
2015-02-12 12:56:47 +00:00
protected $table = 'users';
2015-02-18 17:40:00 +00:00
public $timestamps = false;
2015-02-18 17:13:47 +00: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 12:56:47 +00:00
2015-02-17 14:56:30 +00:00
public function scopeCurrent($query)
{
$email = Auth::user()->email;
return $query->where('email', $email)->first();
}
2015-02-12 12:56:47 +00:00
2015-02-17 14:56:30 +00:00
public function scopeReferents($query)
{
2015-02-17 21:39:53 +00:00
return $query->where('droits', '0');
2015-02-17 14:56:30 +00:00
}
2015-02-12 12:56:47 +00:00
}