Created
February 16, 2017 02:54
-
-
Save ChadTaljaardt/6ec593be5b945fc2b08653ff6347a06c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use App\Traits\UuidModel; | |
use Illuminate\Notifications\Notifiable; | |
use Laravel\Passport\HasApiTokens; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
class User extends Authenticatable | |
{ | |
use Notifiable, UuidModel, HasApiTokens; | |
public $incrementing = false; | |
protected $fillable = [ | |
'name', 'email', 'password', | |
]; | |
protected $hidden = [ | |
'password', 'remember_token', | |
]; | |
public function detections() | |
{ | |
return $this->hasMany('App\Models\Detection', 'user_id', 'id'); | |
} | |
public function plates() | |
{ | |
return $this->belongsToMany('App\Models\Plate', 'detections'); | |
} | |
public function scopeDays($query, $days) | |
{ | |
return $query->where('created_at', Carbon::now()->subDays($days)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment