mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
73 lines
2.5 KiB
PHP
73 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
|
use Eloquent;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Query\Builder;
|
|
use Illuminate\Support\Carbon;
|
|
use Spatie\Activitylog\Models\Activity;
|
|
|
|
/**
|
|
* Class SegmentConstant
|
|
*
|
|
* @package App\Models
|
|
* @property Segment segment_id
|
|
* @property string detail
|
|
* @property int $id
|
|
* @property string $reference
|
|
* @property string $value
|
|
* @property Carbon|null $deleted_at
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property-read Collection|Activity[] $activities
|
|
* @property-read int|null $activities_count
|
|
* @property-read Model|Eloquent $causer
|
|
* @property-read Segment|null $segment
|
|
* @property-read Model|Eloquent $subject
|
|
* @property-read Model|Eloquent $target
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant newQuery()
|
|
* @method static Builder|SegmentConstant onlyTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereDeletedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereReference($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereSegmentId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|SegmentConstant whereValue($value)
|
|
* @method static Builder|SegmentConstant withTrashed()
|
|
* @method static Builder|SegmentConstant withoutTrashed()
|
|
* @mixin Eloquent
|
|
*/
|
|
class SegmentConstant extends AbstractModel
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'segment_constants';
|
|
|
|
public function getDetailAttribute($value)
|
|
{
|
|
return $value ? json_decode($value) : [];
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function segment(): BelongsTo
|
|
{
|
|
return $this->BelongsTo(Segment::class, 'segment_id', 'id');
|
|
}
|
|
|
|
public function getValueAttribute($value)
|
|
{
|
|
$value = $value ? json_decode($value) : [];
|
|
return $value;
|
|
}
|
|
}
|