Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit a0abe66

Browse files
committed
v3.1.1
- add cover to routes - cleanup - update rdme - update wiki
1 parent 16b7d6a commit a0abe66

File tree

4 files changed

+56
-14
lines changed

4 files changed

+56
-14
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636
- for simpleMenu [Wiki](https://github.com/ctf0/simple-menu/wiki/Publish)
3737
- also check the **Dependencies** packages for "configuration/options/migrations".
3838

39+
- add `SMUsers` trait to your **User Model**
40+
```php
41+
use ctf0\SimpleMenu\Models\Traits\SMUsers;
42+
43+
// ...
44+
45+
class User extends Authenticatable
46+
{
47+
use Notifiable, SMUsers;
48+
}
49+
```
50+
3951
- install JS dependencies
4052

4153
```bash

src/Controllers/DummyController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public function handle()
1111
{
1212
extract(SimpleMenu::getRouteData(Route::currentRouteName()));
1313

14-
return view("$this->templatePath.$template", compact('title', 'body', 'desc', 'meta'));
14+
return view("$this->templatePath.$template", compact('title', 'body', 'desc', 'meta', 'cover', 'breadCrumb'));
1515
}
1616
}

src/Controllers/Admin/Traits/SMUsers.php renamed to src/Models/Traits/SMUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ctf0\SimpleMenu\Controllers\Admin\Traits;
3+
namespace ctf0\SimpleMenu\Models\Traits;
44

55
use Spatie\Permission\Traits\HasRoles;
66
use Illuminate\Database\Eloquent\Builder;

src/Traits/RoutesTrait.php

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ protected function utilLoop()
5555
protected function pageComp($page)
5656
{
5757
// page data
58-
$title = $page->title;
59-
$body = $page->body;
60-
$desc = $page->desc;
61-
$meta = $page->meta;
62-
$template = $page->template;
63-
$breadCrumb = $page->getAncestors();
58+
$title = $page->title;
59+
$body = $page->body;
60+
$desc = $page->desc;
61+
$meta = $page->meta;
62+
$cover = $page->cover;
63+
$template = $page->template;
64+
$breadCrumb = $page->getAncestors();
6465

6566
// route data
6667
$url = $page->url;
@@ -73,24 +74,53 @@ protected function pageComp($page)
7374
$permissions = 'perm:' . implode(',', $page->permissions->pluck('name')->toArray());
7475

7576
// make route
76-
$this->routeGen($routeName, $url, $prefix, $action, $roles, $permissions, $template, $title, $body, $desc, $meta, $breadCrumb);
77+
$this->routeGen(
78+
$routeName,
79+
$url,
80+
$prefix,
81+
$action,
82+
$roles,
83+
$permissions,
84+
$template,
85+
$title,
86+
$body,
87+
$desc,
88+
$meta,
89+
$cover,
90+
$breadCrumb
91+
);
7792

7893
// create route list
7994
if (!$this->listFileFound) {
8095
$this->createRoutesList($action, $page, $routeName);
8196
}
8297
}
8398

84-
protected function routeGen($routeName, $url, $prefix, $action, $roles, $permissions, $template, $title, $body, $desc, $meta, $breadCrumb)
85-
{
99+
protected function routeGen(
100+
$routeName,
101+
$url,
102+
$prefix,
103+
$action,
104+
$roles,
105+
$permissions,
106+
$template,
107+
$title,
108+
$body,
109+
$desc,
110+
$meta,
111+
$cover,
112+
$breadCrumb
113+
) {
86114
if ($this->escapeEmptyRoute($url)) {
87115
return;
88116
}
89117

90118
// cache the page so we can pass the page params to the controller@method
91-
$this->cache->tags('sm')->rememberForever($this->getCrntLocale() . "-$routeName", function () use ($template, $title, $body, $desc, $meta, $breadCrumb) {
92-
return compact('template', 'title', 'body', 'desc', 'meta', 'breadCrumb');
93-
});
119+
$this->cache->tags('sm')->rememberForever(
120+
$this->getCrntLocale() . "-$routeName",
121+
function () use ($template, $title, $body, $desc, $meta, $cover, $breadCrumb) {
122+
return compact('template', 'title', 'body', 'desc', 'meta', 'cover', 'breadCrumb');
123+
});
94124

95125
$route = $this->getRouteUrl($url, $prefix);
96126

0 commit comments

Comments
 (0)