update deploy
This commit is contained in:
70
app/Models/Category.php
Normal file
70
app/Models/Category.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\CategoryFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
/** @use HasFactory<CategoryFactory> */
|
||||
use Concerns\HasTurkishSlug, HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function slugSourceField(): string
|
||||
{
|
||||
return 'label';
|
||||
}
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'label',
|
||||
'desc',
|
||||
'image',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return HasMany<Course, $this>
|
||||
*/
|
||||
public function courses(): HasMany
|
||||
{
|
||||
return $this->hasMany(Course::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mega menu'de gösterilecek kurslar (menu_order = 1, 2, 3).
|
||||
*
|
||||
* @return HasMany<Course, $this>
|
||||
*/
|
||||
public function menuCourses(): HasMany
|
||||
{
|
||||
return $this->hasMany(Course::class)
|
||||
->whereNotNull('menu_order')
|
||||
->orderBy('menu_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany<Comment, $this>
|
||||
*/
|
||||
public function comments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Comment::class, 'commentable');
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logFillable()
|
||||
->logOnlyDirty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user