Make sure the user exists

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-07-11 15:59:18 +01:00
parent abd79219dd
commit 759bb822ff

View file

@ -3,13 +3,19 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;
class ConsumableAssignment extends Model
{
use CompanyableTrait;
use ValidatingTrait;
protected $table = 'consumables_users';
public $rules = [
'assigned_to' => 'exists:users,id',
];
public function consumable()
{
return $this->belongsTo(\App\Models\Consumable::class);