eloquent - no request in view

This commit is contained in:
Malibu
2015-02-17 15:56:30 +01:00
parent 759b6a240e
commit 755f691478
6 changed files with 46 additions and 47 deletions

View File

@ -1,34 +1,22 @@
<?php namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Auth;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
class User extends Model {
use Authenticatable, CanResetPassword;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password'];
public $timestamps = false;
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
public function scopeCurrent($query)
{
$email = Auth::user()->email;
return $query->where('email', $email)->first();
}
public function scopeReferents($query)
{
return $query->where('admin', '0');
}
}