Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/job-board.corals.io/Corals/modules/Jobs/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/job-board.corals.io/Corals/modules/Jobs/Models/Job.php
<?php

namespace Corals\Modules\Jobs\Models;

use Corals\Foundation\Models\BaseModel;
use Corals\Foundation\Transformers\PresentableTrait;
use Corals\Modules\Utility\Models\Address\Location;
use Corals\Modules\Utility\Models\ListOfValue\ListOfValue;
use Corals\Modules\Utility\Traits\Category\ModelHasCategory;
use Corals\Modules\Utility\Traits\Tag\HasTags;
use Cviebrock\EloquentSluggable\Sluggable;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;

class Job extends BaseModel implements HasMedia
{
    use PresentableTrait, LogsActivity, ModelHasCategory, HasTags, InteractsWithMedia, Sluggable;

    /**
     *  Model configuration.
     * @var string
     */
    public $config = 'jobs.models.job';

    protected static $logAttributes = [];

    protected $table = 'jo_jobs';

    public $mediaCollectionName = 'jobs-job-thumbnail';

    protected $casts = [
        'properties' => 'json',
        'schedule' => 'json',
    ];

    protected $guarded = ['id'];

    public function getImageAttribute()
    {
        $media = $this->getFirstMedia($this->mediaCollectionName);

        if ($media) {
            return $media->getFullUrl();
        } else {

            return asset(config($this->config . '.default_image'));
        }
    }

    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'title',
                'onUpdate' => true
            ]
        ];
    }

    public function owner()
    {
        return $this->belongsTo(Employer::class);
    }

    public function jobApplications()
    {
        return $this->hasMany(JobApplication::class);
    }

    public function location()
    {
        return $this->belongsTo(Location::class);
    }

    public function jobType()
    {
        return $this->belongsTo(ListOfValue::class, 'job_type', 'code');
    }

    public function experienceLevel()
    {
        return $this->belongsTo(ListOfValue::class, 'experience_level', 'code');
    }

    public function activeCategories()
    {
        return $this->categories()->where('utility_categories.status', 'active');
    }

    public function scopePublished($query)
    {
        return $query->where('jo_jobs.status', '=', 'published');
    }

    public function getPublicShowURL()
    {
        return url('jobs/' . $this->slug);
    }

}

Spamworldpro Mini