Fix Bug#100

This commit is contained in:
Mathieu Lagace
2019-08-29 11:09:48 -04:00
parent d01bf2fca7
commit dda94c1b7c
3 changed files with 14 additions and 2 deletions

View File

@@ -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);
}