mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-27 08:24:14 +00:00
71 lines
2.4 KiB
PHP
71 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Eloquent;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Query\Builder;
|
|
use Illuminate\Support\Carbon;
|
|
use Spatie\Activitylog\Models\Activity;
|
|
|
|
/**
|
|
* Class Segment
|
|
*
|
|
* @package App\Models
|
|
* @property string name
|
|
* @property string reference
|
|
* @property int $id
|
|
* @property int $company_module_id
|
|
* @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 Collection|SegmentConstant[] $constants
|
|
* @property-read int|null $constants_count
|
|
* @property-read Model|Eloquent $subject
|
|
* @property-read Model|Eloquent $target
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment newQuery()
|
|
* @method static Builder|Segment onlyTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereCompanyModuleId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereDeletedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Segment whereUpdatedAt($value)
|
|
* @method static Builder|Segment withTrashed()
|
|
* @method static Builder|Segment withoutTrashed()
|
|
* @mixin Eloquent
|
|
*/
|
|
class Segment extends AbstractModel
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'segments';
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
/**
|
|
* @return HasMany
|
|
*/
|
|
public function constants(): HasMany
|
|
{
|
|
return $this->HasMany(SegmentConstant::class, 'segment_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsToMany
|
|
*/
|
|
public function companyConnections(): belongsToMany
|
|
{
|
|
return $this->belongsToMany(CompanyConnection::class, (new ConnectionSegment())->getTable(), 'segment_id', 'company_connection_id');
|
|
}
|
|
}
|