first commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Version extends Model
|
||||
{
|
||||
protected $table = 'store_versions';
|
||||
|
||||
protected $fillable = [
|
||||
'package_id',
|
||||
'version',
|
||||
'changelog',
|
||||
'typecho_min',
|
||||
'typecho_max',
|
||||
'php_min',
|
||||
'php_max',
|
||||
'php_extensions',
|
||||
'package_url',
|
||||
'package_size',
|
||||
'sha256',
|
||||
'is_stable',
|
||||
'is_latest',
|
||||
'download_count',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_stable' => 'boolean',
|
||||
'is_latest' => 'boolean',
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo(Package::class, 'package_id');
|
||||
}
|
||||
|
||||
public function getPhpExtensionsArrayAttribute()
|
||||
{
|
||||
$value = $this->php_extensions;
|
||||
if (empty($value)) {
|
||||
return [];
|
||||
}
|
||||
$decoded = json_decode($value, true);
|
||||
return is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user