snipe-it/app/Models/ConsumableAssignment.php

34 lines
681 B
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
2016-03-25 01:18:05 -07:00
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;
2016-03-25 01:18:05 -07:00
class ConsumableAssignment extends Model
{
use CompanyableTrait;
use ValidatingTrait;
2016-03-25 01:18:05 -07:00
protected $table = 'consumables_users';
public $rules = [
'assigned_to' => 'required|exists:users,id',
];
2016-03-25 01:18:05 -07:00
public function consumable()
{
return $this->belongsTo(\App\Models\Consumable::class);
2016-03-25 01:18:05 -07:00
}
public function user()
{
return $this->belongsTo(\App\Models\User::class, 'assigned_to');
2016-03-25 01:18:05 -07:00
}
public function adminuser()
2016-03-25 01:18:05 -07:00
{
return $this->belongsTo(\App\Models\User::class, 'created_by');
2016-03-25 01:18:05 -07:00
}
}