Skip to content

A free open source IT asset/license management system

Make sure the user exists

snipe759bb822ff93
diff --git a/app/Models/ConsumableAssignment.php b/app/Models/ConsumableAssignment.php
index 1e21a7f7d2..ae84cd19dc 100644
--- a/app/Models/ConsumableAssignment.php
+++ b/app/Models/ConsumableAssignment.php
@@ -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);