File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/CareersJobs/Models/CareersJob.php
<?php
/**
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\Komma\CareersJobs\Models;
use App\Komma\Dynamic\ComponentArea\HasComponentAreasInterface;
use App\Komma\Dynamic\ComponentArea\HasComponentAreasTrait;
use App\Komma\Kms\Core\Attributes\Models\Traits\HasThumbnailInterface;
use App\Komma\Kms\Core\Attributes\Models\Traits\HasThumbnailTrait;
use App\Komma\Kms\Core\Entities\DisplayNameInterface;
use App\Komma\Kms\Core\Entities\DisplayNameTrait;
use App\Komma\Kms\Core\NestedSets\Nodes\TreeModelInterface;
use App\Komma\Kms\Core\NestedSets\Nodes\TreeModelLogicTrait;
use App\Komma\Sites\Models\Site;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CareersJob extends Model implements TreeModelInterface, DisplayNameInterface, HasThumbnailInterface, HasComponentAreasInterface
{
use HasThumbnailTrait;
use TreeModelLogicTrait;
use DisplayNameTrait;
use HasComponentAreasTrait;
protected $table = 'careers_jobs';
protected $class = self::class;
protected $fillable = ['site_id', 'lft', 'rgt', 'tree', 'created_at', 'updated_at'];
/**
* Get the site for this this model
*
* @return belongsTo
*/
public function site(): BelongsTo
{
return $this->belongsTo(Site::class, 'site_id'); //Model must have site_id attribute
}
public function getColorStatusNumber():int
{
if (empty($this->careers_id)) {
return 0;
}
if (! $this->active) {
return 0;
}
return 1;
}
}