fixed module
This commit is contained in:
parent
408a785844
commit
79304cb18b
|
|
@ -2,24 +2,33 @@
|
|||
|
||||
namespace Beike\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
/**
|
||||
* 通过page builder 显示首页
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$html = '';
|
||||
$designSettings = system_setting('base.design_setting');
|
||||
$modules = $designSettings['modules'] ?? [];
|
||||
|
||||
$moduleItems = [];
|
||||
foreach ($modules as $module) {
|
||||
$code = $module['code'];
|
||||
$content = $module['content'];
|
||||
$viewPath = "design.{$code}";
|
||||
if (view()->exists($viewPath)) {
|
||||
$html .= view($viewPath, $content)->render();
|
||||
$moduleItems[] = [
|
||||
'view_path' => $viewPath,
|
||||
'content' => $content
|
||||
];
|
||||
}
|
||||
}
|
||||
$data['html'] = $html;
|
||||
|
||||
return view('home', $data);
|
||||
return view('home', ['modules' => $moduleItems]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@
|
|||
@section('content')
|
||||
|
||||
|
||||
{{--@foreach($renders as $render)--}}
|
||||
{{-- <x-dynamic-component :component="$render"/>--}}
|
||||
{{--@endforeach--}}
|
||||
|
||||
{!! $html !!}
|
||||
@foreach($modules as $module)
|
||||
@include($module['view_path'], $module['content'])
|
||||
@endforeach
|
||||
|
||||
{{-- <script>
|
||||
$(function() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue