30 lines
579 B
PHP
Executable File
30 lines
579 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasCacheModel;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Package extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasCacheModel;
|
|
|
|
protected $table = 'package';
|
|
|
|
/**
|
|
* Check active and get by code
|
|
*
|
|
* @param string $code
|
|
* @return TValue|TFirstDefault
|
|
*/
|
|
public static function firstActiveById(string $id)
|
|
{
|
|
return static::getByCache()
|
|
->where('id', $id)
|
|
->where('status', 1)
|
|
->first();
|
|
}
|
|
}
|