File: /home/xedaptot/work.naniguide.com/app/Models/LeadPipelineStages.php
<?php
namespace App\Models;
use App\Traits\HasCompany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* App\Models\LeadStatus
*
* @property int $id
* @property string $type
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $priority
* @property int $default
* @property string $label_color
* @property-read mixed $icon
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Lead[] $leads
* @property-read int|null $leads_count
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus query()
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereDefault($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereLabelColor($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus wherePriority($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereType($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereUpdatedAt($value)
* @property int|null $company_id
* @property-read \App\Models\Company|null $company
* @method static \Illuminate\Database\Eloquent\Builder|LeadStatus whereCompanyId($value)
* @property int|null $lead_pipeline_id
* @property int|null $pipeline_stages_id
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Deal> $deals
* @property-read int|null $deals_count
* @property-read \App\Models\LeadPipeline|null $pipeline
* @property-read \App\Models\PipelineStage $stage
* @method static \Illuminate\Database\Eloquent\Builder|LeadPipelineStages whereLeadPipelineId($value)
* @method static \Illuminate\Database\Eloquent\Builder|LeadPipelineStages wherePipelineStagesId($value)
* @mixin \Eloquent
*/
class LeadPipelineStages extends BaseModel
{
use HasCompany;
public function deals(): HasMany
{
return $this->hasMany(Deal::class, 'pipeline_stage_id')->orderBy('priority');
}
public function pipeline(): BelongsTo
{
return $this->belongsTo(LeadPipeline::class, 'lead_pipeline_id');
}
public function stage(): BelongsTo
{
return $this->belongsTo(PipelineStage::class, 'pipeline_stage_id');
}
}