new admin design with mnodules
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Administration\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
final class ModuleController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$statuses = json_decode((string) file_get_contents(base_path('modules_statuses.json')), true) ?: [];
|
||||
$modules = collect(glob(base_path('Modules/*/module.json')) ?: [])->map(function (string $manifest) use ($statuses): array {
|
||||
$data = json_decode((string) file_get_contents($manifest), true) ?: [];
|
||||
$name = $data['name'] ?? basename(dirname($manifest));
|
||||
return [
|
||||
'name' => $name,
|
||||
'description' => $data['description'] ?? 'Laravel application module.',
|
||||
'version' => $data['version'] ?? '1.0.0',
|
||||
'enabled' => (bool) ($statuses[$name] ?? false),
|
||||
'providers' => $data['providers'] ?? [],
|
||||
];
|
||||
})->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE)->values();
|
||||
|
||||
return view('administration::modules.index', compact('modules'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user