Skip to content

Instantly share code, notes, and snippets.

@ChadTaljaardt
Created February 16, 2017 01:57
Show Gist options
  • Save ChadTaljaardt/b15b1f6cc1145335c88e844d746ca1b5 to your computer and use it in GitHub Desktop.
Save ChadTaljaardt/b15b1f6cc1145335c88e844d746ca1b5 to your computer and use it in GitHub Desktop.
<?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