diff --git a/app/Item.php b/app/Item.php index 00041aa0..e1ed7d79 100644 --- a/app/Item.php +++ b/app/Item.php @@ -3,6 +3,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use mysql_xdevapi\Collection; class Item extends Model { @@ -29,6 +30,17 @@ class Item extends Model public function category() { + if (\App\ItemCategory::find($this->category_id) == null) + { + $this->category_id = -1; + $this->save(); + $c = new \App\ItemCategory(); + $c->name = "[Categorie Supprimé]"; + $c->is_training = 0; + $c->is_op_appro = 0; + + return $c; + } return \App\ItemCategory::find($this->category_id); } diff --git a/resources/views/admin/inventory/index.blade.php b/resources/views/admin/inventory/index.blade.php index b89ec947..94f79d82 100644 --- a/resources/views/admin/inventory/index.blade.php +++ b/resources/views/admin/inventory/index.blade.php @@ -10,7 +10,7 @@