Big update for category controller - for admin panel

This commit is contained in:
2022-02-15 15:26:10 +01:00
parent 982438a26e
commit 38e5a8f485
19 changed files with 363 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
@@ -25,4 +25,13 @@ class Category extends Model
'default' => 'bool',
'visible' => 'bool'
];
public function scopeVisibled(Builder $builder)
{
return $builder->where(function (Builder $query) {
$query->where('visible', true)
->orWhere('default', true);
});
}
}