fixed plugins
This commit is contained in:
parent
4f264f3205
commit
f5a48b3539
|
|
@ -11,11 +11,13 @@
|
|||
|
||||
namespace Beike\Admin\Http\Controllers;
|
||||
|
||||
use Beike\Models\Customer;
|
||||
use Exception;
|
||||
use Beike\Plugin\Manager;
|
||||
use Illuminate\Http\Request;
|
||||
use Beike\Repositories\SettingRepo;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Beike\Admin\Http\Resources\PluginResource;
|
||||
|
||||
class PluginController extends Controller
|
||||
{
|
||||
|
|
@ -24,7 +26,8 @@ class PluginController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['plugins'] = (new Manager)->getPlugins();
|
||||
$plugins = (new Manager)->getPlugins();
|
||||
$data['plugins'] = PluginResource::collection($plugins)->jsonSerialize();
|
||||
return view('admin::pages.plugins.index', $data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Beike\Admin\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PluginResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
$data = [
|
||||
'name' => $this->name,
|
||||
'version' => $this->version,
|
||||
'path' => $this->path,
|
||||
'code' => $this->code,
|
||||
'description' => $this->description,
|
||||
'type' => $this->type,
|
||||
'icon' => $this->icon,
|
||||
'author' => $this->author,
|
||||
'status' => $this->getStatus(),
|
||||
'edit_url' => $this->getEditUrl(),
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue