2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
2021-06-10 13:15:52 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-07-11 07:59:18 -07:00
|
|
|
use Watson\Validating\ValidatingTrait;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
class ConsumableAssignment extends Model
|
|
|
|
{
|
|
|
|
use CompanyableTrait;
|
2024-07-11 07:59:18 -07:00
|
|
|
use ValidatingTrait;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
protected $table = 'consumables_users';
|
|
|
|
|
2024-07-11 07:59:18 -07:00
|
|
|
public $rules = [
|
2024-07-11 08:18:42 -07:00
|
|
|
'assigned_to' => 'required|exists:users,id',
|
2024-07-11 07:59:18 -07:00
|
|
|
];
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
public function consumable()
|
|
|
|
{
|
2021-06-10 13:16:56 -07:00
|
|
|
return $this->belongsTo(\App\Models\Consumable::class);
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
2021-06-10 13:16:56 -07:00
|
|
|
return $this->belongsTo(\App\Models\User::class, 'assigned_to');
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
|
2024-09-17 14:16:41 -07:00
|
|
|
public function adminuser()
|
2016-03-25 01:18:05 -07:00
|
|
|
{
|
2024-09-17 14:16:41 -07:00
|
|
|
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
}
|