add plugin show page

This commit is contained in:
Edward Yang 2022-09-26 17:23:02 +08:00
parent 5671f2d2bf
commit e89272aeec
5 changed files with 0 additions and 107 deletions

View File

@ -1,35 +0,0 @@
<?php
/**
* bootstrap.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-20 15:35:59
* @modified 2022-07-20 15:35:59
*/
namespace Plugin\HeaderMenu;
class Bootstrap
{
public function boot()
{
add_filter('header.categories', function ($data) {
$data[] = [
'name' => '插件链接',
'url' => shop_route('home.index'),
'children' => [
[
"name" => "最新商品",
"url" => plugin_route('latest_products'),
], [
"name" => "百度",
"url" => "https://www.baidu.com",
]
],
];
return $data;
});
}
}

View File

@ -1,24 +0,0 @@
<?php
/**
* MenusController.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-21 10:00:25
* @modified 2022-07-21 10:00:25
*/
namespace Plugin\HeaderMenu\Controllers;
use Beike\Repositories\ProductRepo;
use Beike\Shop\Http\Controllers\Controller;
class MenusController extends Controller
{
public function latestProducts()
{
$products = ProductRepo::getBuilder()->orderByDesc('updated_at')->paginate(40);
return view("HeaderMenu::latest_products", ['products' => $products]);
}
}

View File

@ -1,21 +0,0 @@
@extends('layout.master')
@section('content')
<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>
<div class="row">
@foreach ($products as $product)
<div class="col-6 col-md-3">@include('shared.product')</div>
@endforeach
</div>
{{ $products->links('shared/pagination/bootstrap-4') }}
</div>
@endsection

View File

@ -1,12 +0,0 @@
{
"code": "header_menu",
"name": "首页菜单Demo",
"description": "修改首页菜单插件",
"type": "view",
"version": "v1.0.0",
"icon": "https://via.placeholder.com/100x100.png/aabbcc?text=MENU",
"author": {
"name": "成都光大网络科技有限公司",
"email": "yangjin@opencart.cn"
}
}

View File

@ -1,15 +0,0 @@
<?php
/**
* route.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-21 09:35:05
* @modified 2022-07-21 09:35:05
*/
use Illuminate\Support\Facades\Route;
Route::get('/latest_products', '\Plugin\HeaderMenu\Controllers\MenusController@latestProducts')->name('plugin.latest_products');