generated from liutk/owl-admin-base
32 lines
689 B
PHP
32 lines
689 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
|
|
|
class PlanPerformance extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'month', 'store_category_id', 'store_level_id', 'performance',
|
|
];
|
|
|
|
public function plan(): MorphOne
|
|
{
|
|
return $this->morphOne(Plan::class, 'planable');
|
|
}
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(Keyword::class, 'store_category_id', 'key');
|
|
}
|
|
|
|
public function level()
|
|
{
|
|
return $this->belongsTo(Keyword::class, 'store_level_id', 'key');
|
|
}
|
|
}
|