Created
February 16, 2017 01:57
-
-
Save ChadTaljaardt/b15b1f6cc1145335c88e844d746ca1b5 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) | |
{ | |
return $query->where('created_at', Carbon::now()->subDay()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment