Anons79 Mini Shell

Directory : /home/aplikasiposinfo/.trash/app.4/Models/
Upload File :
Current File : /home/aplikasiposinfo/.trash/app.4/Models/Trainer.php

<?php

namespace App\Models;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\Model;

class Trainer extends Model implements HasMedia
{
    use InteractsWithMedia;
    use HasRoles; 

    public $table = 'trainer';

    public $fillable = [
        'full_name',
        'title',
        'biodata',
        'birth_date',
        'birth_place',
        'gender',
        'address',
        'phone_number',
        'facebook',
        'twitter',
        'whatsapp',
        'telegram',
        'web',
        'users_id'
    ];

    protected $casts = [
        'full_name' => 'string',
        'title' => 'string',
        'biodata' => 'string',
        'birth_date' => 'date',
        'birth_place' => 'string',
        'gender' => 'string',
        'address' => 'string',
        'phone_number' => 'string',
        'facebook' => 'string',
        'twitter' => 'string',
        'whatsapp' => 'string',
        'telegram' => 'string',
        'web' => 'string'
    ];

    public static array $rules = [
        'full_name' => 'nullable|string|max:255',
        'title' => 'nullable|string|max:255',
        'biodata' => 'nullable|string',
        'birth_date' => 'nullable',
        'birth_place' => 'nullable|string|max:255',
        'gender' => 'nullable|string|max:45',
        'address' => 'nullable|string',
        'phone_number' => 'nullable|string|max:255',
        'facebook' => 'nullable|string|max:255',
        'twitter' => 'nullable|string|max:255',
        'whatsapp' => 'nullable|string|max:255',
        'telegram' => 'nullable|string|max:255',
        'web' => 'nullable|string|max:255',
        'created_at' => 'nullable',
        'updated_at' => 'nullable',
        'deleted_at' => 'nullable',
        'users_id' => 'nullable'
    ];

    public function getSlugOptions() : SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('title')
            ->saveSlugsTo('slug');
        }

    public function registerMediaConversions(Media $media = null): void
    {
        $this->addMediaConversion('preview')
            ->fit(Manipulations::FIT_CROP, 300, 300)
            ->nonQueued();

        $this->addMediaConversion('thumb')
            ->width(368)
            ->height(232)
            ->sharpen(10);

        $this->addMediaConversion('cover')
            ->width(2400)
            ->height(1800);
    }


    public function users(): \Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(\App\Models\User::class, 'users_id');
    }

    public function classTrainers(): \Illuminate\Database\Eloquent\Relations\HasMany
    {
        return $this->hasMany(\App\Models\ClassTrainer::class, 'trainer_id');
    }

    public function courseTrainers(): \Illuminate\Database\Eloquent\Relations\HasMany
    {
        return $this->hasMany(\App\Models\CourseTrainer::class, 'trainer_id');
    }
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]