update deploy
This commit is contained in:
60
app/Models/Announcement.php
Normal file
60
app/Models/Announcement.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\AnnouncementCategory;
|
||||
use Database\Factories\AnnouncementFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Announcement extends Model
|
||||
{
|
||||
/** @use HasFactory<AnnouncementFactory> */
|
||||
use Concerns\HasTurkishSlug, HasFactory, LogsActivity;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'title',
|
||||
'category',
|
||||
'excerpt',
|
||||
'content',
|
||||
'image',
|
||||
'is_featured',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'category' => AnnouncementCategory::class,
|
||||
'is_featured' => 'boolean',
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany<Comment, $this>
|
||||
*/
|
||||
public function comments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Comment::class, 'commentable');
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logFillable()
|
||||
->logOnlyDirty();
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
46
app/Models/Comment.php
Normal file
46
app/Models/Comment.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\CommentFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
/** @use HasFactory<CommentFactory> */
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'commentable_id',
|
||||
'commentable_type',
|
||||
'name_surname',
|
||||
'phone',
|
||||
'body',
|
||||
'admin_reply',
|
||||
'is_approved',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_approved' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo<Model, $this>
|
||||
*/
|
||||
public function commentable(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
24
app/Models/Concerns/HasTurkishSlug.php
Normal file
24
app/Models/Concerns/HasTurkishSlug.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Concerns;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait HasTurkishSlug
|
||||
{
|
||||
protected function slugSourceField(): string
|
||||
{
|
||||
return 'title';
|
||||
}
|
||||
|
||||
protected static function bootHasTurkishSlug(): void
|
||||
{
|
||||
static::saving(function ($model): void {
|
||||
if (empty($model->slug) && $model->{$model->slugSourceField()}) {
|
||||
$model->slug = Str::turkishSlug($model->{$model->slugSourceField()});
|
||||
} else {
|
||||
$model->slug = Str::turkishSlug($model->slug);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
101
app/Models/Course.php
Normal file
101
app/Models/Course.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\CourseBadge;
|
||||
use Database\Factories\CourseFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
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 Course extends Model
|
||||
{
|
||||
/** @use HasFactory<CourseFactory> */
|
||||
use Concerns\HasTurkishSlug, HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'slug',
|
||||
'title',
|
||||
'sub',
|
||||
'desc',
|
||||
'long_desc',
|
||||
'duration',
|
||||
'students',
|
||||
'rating',
|
||||
'badge',
|
||||
'menu_order',
|
||||
'image',
|
||||
'price',
|
||||
'includes',
|
||||
'requirements',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'scope',
|
||||
'standard',
|
||||
'language',
|
||||
'location',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'badge' => CourseBadge::class,
|
||||
'includes' => 'array',
|
||||
'requirements' => 'array',
|
||||
'scope' => 'array',
|
||||
'students' => 'integer',
|
||||
'rating' => 'decimal:1',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Category, $this>
|
||||
*/
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<CourseSchedule, $this>
|
||||
*/
|
||||
public function schedules(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseSchedule::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<CourseBlock, $this>
|
||||
*/
|
||||
public function blocks(): HasMany
|
||||
{
|
||||
return $this->hasMany(CourseBlock::class)->orderBy('order_index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany<Comment, $this>
|
||||
*/
|
||||
public function comments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Comment::class, 'commentable');
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logFillable()
|
||||
->logOnlyDirty();
|
||||
}
|
||||
}
|
||||
45
app/Models/CourseBlock.php
Normal file
45
app/Models/CourseBlock.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\CourseBlockFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class CourseBlock extends Model
|
||||
{
|
||||
/** @use HasFactory<CourseBlockFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'course_id',
|
||||
'type',
|
||||
'content',
|
||||
'order_index',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'content' => 'array',
|
||||
'order_index' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Course, $this>
|
||||
*/
|
||||
public function course(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Course::class);
|
||||
}
|
||||
}
|
||||
56
app/Models/CourseSchedule.php
Normal file
56
app/Models/CourseSchedule.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\CourseScheduleFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class CourseSchedule extends Model
|
||||
{
|
||||
/** @use HasFactory<CourseScheduleFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'course_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'location',
|
||||
'instructor',
|
||||
'quota',
|
||||
'available_seats',
|
||||
'enrolled_count',
|
||||
'price_override',
|
||||
'status',
|
||||
'is_urgent',
|
||||
'notes',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'quota' => 'integer',
|
||||
'available_seats' => 'integer',
|
||||
'enrolled_count' => 'integer',
|
||||
'price_override' => 'decimal:2',
|
||||
'is_urgent' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Course, $this>
|
||||
*/
|
||||
public function course(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Course::class);
|
||||
}
|
||||
}
|
||||
37
app/Models/Faq.php
Normal file
37
app/Models/Faq.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\FaqCategory;
|
||||
use Database\Factories\FaqFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Faq extends Model
|
||||
{
|
||||
/** @use HasFactory<FaqFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'category',
|
||||
'question',
|
||||
'answer',
|
||||
'order_index',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'category' => FaqCategory::class,
|
||||
'order_index' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Models/GuideCard.php
Normal file
37
app/Models/GuideCard.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\GuideCardFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GuideCard extends Model
|
||||
{
|
||||
/** @use HasFactory<GuideCardFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'icon',
|
||||
'color',
|
||||
'link',
|
||||
'order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'order' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Models/HeroSlide.php
Normal file
42
app/Models/HeroSlide.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\HeroSlideFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HeroSlide extends Model
|
||||
{
|
||||
/** @use HasFactory<HeroSlideFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'label',
|
||||
'title',
|
||||
'description',
|
||||
'media_type',
|
||||
'image',
|
||||
'video_url',
|
||||
'mobile_video_url',
|
||||
'mobile_image',
|
||||
'button_text',
|
||||
'button_url',
|
||||
'order_index',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'order_index' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
61
app/Models/Lead.php
Normal file
61
app/Models/Lead.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\LeadSource;
|
||||
use App\Enums\LeadStatus;
|
||||
use Database\Factories\LeadFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Lead extends Model
|
||||
{
|
||||
/** @use HasFactory<LeadFactory> */
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'phone',
|
||||
'email',
|
||||
'target_course',
|
||||
'education_level',
|
||||
'subject',
|
||||
'message',
|
||||
'status',
|
||||
'notes',
|
||||
'is_read',
|
||||
'source',
|
||||
'utm',
|
||||
'consent_kvkk',
|
||||
'marketing_consent',
|
||||
'consent_text_version',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => LeadStatus::class,
|
||||
'source' => LeadSource::class,
|
||||
'is_read' => 'boolean',
|
||||
'utm' => 'array',
|
||||
'consent_kvkk' => 'boolean',
|
||||
'marketing_consent' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logFillable()
|
||||
->logOnlyDirty();
|
||||
}
|
||||
}
|
||||
59
app/Models/Menu.php
Normal file
59
app/Models/Menu.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\MenuLocation;
|
||||
use App\Enums\MenuType;
|
||||
use Database\Factories\MenuFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Menu extends Model
|
||||
{
|
||||
/** @use HasFactory<MenuFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'location',
|
||||
'label',
|
||||
'url',
|
||||
'type',
|
||||
'parent_id',
|
||||
'order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'location' => MenuLocation::class,
|
||||
'type' => MenuType::class,
|
||||
'order' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<self, $this>
|
||||
*/
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<self, $this>
|
||||
*/
|
||||
public function children(): HasMany
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id')->orderBy('order');
|
||||
}
|
||||
}
|
||||
43
app/Models/Page.php
Normal file
43
app/Models/Page.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\PageFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
/** @use HasFactory<PageFactory> */
|
||||
use Concerns\HasTurkishSlug, HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'title',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<PageBlock, $this>
|
||||
*/
|
||||
public function blocks(): HasMany
|
||||
{
|
||||
return $this->hasMany(PageBlock::class)->orderBy('order_index');
|
||||
}
|
||||
}
|
||||
45
app/Models/PageBlock.php
Normal file
45
app/Models/PageBlock.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\PageBlockFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PageBlock extends Model
|
||||
{
|
||||
/** @use HasFactory<PageBlockFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'page_id',
|
||||
'type',
|
||||
'content',
|
||||
'order_index',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'content' => 'array',
|
||||
'order_index' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Page, $this>
|
||||
*/
|
||||
public function page(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Page::class);
|
||||
}
|
||||
}
|
||||
54
app/Models/Setting.php
Normal file
54
app/Models/Setting.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\SettingGroup;
|
||||
use App\Enums\SettingType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
/**
|
||||
* Keys that should never appear in public API responses.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
public const SENSITIVE_KEY_PATTERNS = ['_key', '_secret', '_password'];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'group',
|
||||
'key',
|
||||
'value',
|
||||
'type',
|
||||
'label',
|
||||
'order_index',
|
||||
'is_public',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'group' => SettingGroup::class,
|
||||
'type' => SettingType::class,
|
||||
'is_public' => 'boolean',
|
||||
'order_index' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function isSensitive(): bool
|
||||
{
|
||||
foreach (self::SENSITIVE_KEY_PATTERNS as $pattern) {
|
||||
if (str_contains($this->key, $pattern)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
38
app/Models/Story.php
Normal file
38
app/Models/Story.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\StoryFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Story extends Model
|
||||
{
|
||||
/** @use HasFactory<StoryFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'badge',
|
||||
'content',
|
||||
'image',
|
||||
'cta_text',
|
||||
'cta_url',
|
||||
'order_index',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'order_index' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
54
app/Models/User.php
Normal file
54
app/Models/User.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasApiTokens, HasFactory, HasRoles, LogsActivity, Notifiable, SoftDeletes;
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logFillable()
|
||||
->logOnlyDirty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user