mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
36 lines
799 B
PHP
36 lines
799 B
PHP
<?php namespace System\Models;
|
|
|
|
use Model;
|
|
use System\Classes\PluginManager;
|
|
|
|
class PluginVersion extends Model
|
|
{
|
|
|
|
public $table = 'system_plugin_versions';
|
|
|
|
/**
|
|
* @var array Guarded fields
|
|
*/
|
|
protected $guarded = ['*'];
|
|
|
|
/**
|
|
* After the model is populated
|
|
*/
|
|
public function afterFetch()
|
|
{
|
|
/*
|
|
* Override the database columns with the plugin details
|
|
* found in the plugin registration file.
|
|
*/
|
|
$manager = PluginManager::instance();
|
|
$pluginObj = $manager->findByIdentifier($this->code);
|
|
|
|
if ($pluginObj) {
|
|
$pluginInfo = $pluginObj->pluginDetails();
|
|
foreach ($pluginInfo as $attribute => $info) {
|
|
$this->{$attribute} = $info;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |