style updates
This commit is contained in:
@@ -1,14 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Marketplace\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
final class InstalledPackage extends Model
|
||||
{
|
||||
protected $table='marketplace_installed_packages';
|
||||
protected $fillable=['marketplace_package_id','package_name','type','version','status','manifest','checksum','install_path','is_enabled','installed_by','installed_at','updated_at_marketplace'];
|
||||
protected $casts=['manifest'=>'array','is_enabled'=>'boolean','installed_at'=>'datetime','updated_at_marketplace'=>'datetime'];
|
||||
public function package(): BelongsTo { return $this->belongsTo(MarketplacePackage::class,'marketplace_package_id'); }
|
||||
public function installations(): HasMany { return $this->hasMany(Installation::class,'installed_package_id'); }
|
||||
public function hasUpdate(): bool { return $this->package?->latest_version && version_compare($this->package->latest_version,$this->version,'>'); }
|
||||
protected $table = 'marketplace_installed_packages';
|
||||
|
||||
protected $fillable = ['marketplace_package_id', 'package_name', 'type', 'version', 'status', 'manifest', 'checksum', 'install_path', 'is_enabled', 'installed_by', 'installed_at', 'updated_at_marketplace'];
|
||||
|
||||
protected $casts = ['manifest' => 'array', 'is_enabled' => 'boolean', 'installed_at' => 'datetime', 'updated_at_marketplace' => 'datetime'];
|
||||
|
||||
public function package(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MarketplacePackage::class, 'marketplace_package_id');
|
||||
}
|
||||
|
||||
public function installations(): HasMany
|
||||
{
|
||||
return $this->hasMany(Installation::class, 'installed_package_id');
|
||||
}
|
||||
|
||||
public function hasUpdate(): bool
|
||||
{
|
||||
return $this->package?->latest_version && version_compare($this->package->latest_version, $this->version, '>');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user