让分类、会员和示例工具共用同一账号,本地即可跑通登录与授权。 Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
595 B
PHP
30 lines
595 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Subscription extends Model
|
|
{
|
|
protected $fillable = ['user_id', 'plan_id', 'status', 'starts_at', 'ends_at'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'starts_at' => 'datetime',
|
|
'ends_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function plan(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Plan::class);
|
|
}
|
|
}
|