webseite funktioniert, pay sdk, blog backend funktioniert
This commit is contained in:
@@ -2,24 +2,44 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
use Stephenjude\FilamentBlog\Models\Category as BaseCategory;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BlogCategory extends BaseCategory
|
||||
class BlogCategory extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, HasTranslations;
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $translatable = [
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
protected $table = 'blog_categories';
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'is_visible',
|
||||
'translations',
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_visible' => 'boolean',
|
||||
'name' => 'array',
|
||||
'description' => 'array',
|
||||
];
|
||||
|
||||
public function posts(): HasMany
|
||||
{
|
||||
return $this->hasMany(BlogPost::class, 'blog_category_id');
|
||||
}
|
||||
|
||||
public function scopeIsVisible(Builder $query)
|
||||
{
|
||||
return $query->where('is_visible', true);
|
||||
}
|
||||
|
||||
public function scopeIsInvisible(Builder $query)
|
||||
{
|
||||
return $query->where('is_visible', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user