add shipping rules
This commit is contained in:
@@ -6,8 +6,6 @@ use Auth;
|
||||
use Illuminate\Support\Collection;
|
||||
use Lavary\Menu\Builder as LavaryMenuBuilder;
|
||||
|
||||
use App\Repositories\Users;
|
||||
|
||||
/**
|
||||
* Class Builder.
|
||||
*
|
||||
@@ -20,9 +18,8 @@ class Builder extends LavaryMenuBuilder
|
||||
/**
|
||||
* Adds an item to the menu.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $options
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $options
|
||||
* @return \Lavary\Menu\Item|Item
|
||||
*/
|
||||
public function add($title, $options = '')
|
||||
@@ -65,8 +62,7 @@ class Builder extends LavaryMenuBuilder
|
||||
*
|
||||
* @param $id Id of the menu item to attach to
|
||||
* @param $title Title of the sub item
|
||||
* @param string $options
|
||||
*
|
||||
* @param string $options
|
||||
* @return Lavary\Menu\Item
|
||||
*/
|
||||
public function addTo($id, $title, $options = '')
|
||||
@@ -74,7 +70,7 @@ class Builder extends LavaryMenuBuilder
|
||||
$parent = $this->whereId($id)->first();
|
||||
|
||||
if (isset($parent)) {
|
||||
if (!isset($this->root[$parent->id])) {
|
||||
if (! isset($this->root[$parent->id])) {
|
||||
$parent->attr(['url' => '#', 'class' => 'treeview']);
|
||||
// $str = '<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>';
|
||||
// $parent->append($str);
|
||||
|
||||
@@ -9,7 +9,6 @@ class Item extends LavaryMenuItem
|
||||
/**
|
||||
* Set the item icon using font-awesome.
|
||||
*
|
||||
* @param $icon
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
@@ -23,7 +22,6 @@ class Item extends LavaryMenuItem
|
||||
/**
|
||||
* Set the item order.
|
||||
*
|
||||
* @param $order
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
@@ -37,29 +35,29 @@ class Item extends LavaryMenuItem
|
||||
/**
|
||||
* Make the item active.
|
||||
*
|
||||
* @param string|array $routes
|
||||
*
|
||||
* @param string|array $routes
|
||||
* @return self
|
||||
*/
|
||||
public function activeIfRoute($routes = null)
|
||||
{
|
||||
if (!empty($routes)) {
|
||||
if (! empty($routes)) {
|
||||
if (is_string($routes)) {
|
||||
$routes = [$routes];
|
||||
}
|
||||
|
||||
foreach ($routes as $pattern) {
|
||||
$arr = [$pattern];
|
||||
if (!if_route_pattern($arr)){
|
||||
continue;}
|
||||
$this->activate();
|
||||
|
||||
if (strstr($this->title, 'circle-o')) {
|
||||
$this->title = str_replace('fa-circle-o', 'fa-dot-circle-o', $this->title);
|
||||
}
|
||||
// dump($this);
|
||||
return $this;
|
||||
if (! if_route_pattern($arr)) {
|
||||
continue;
|
||||
}
|
||||
$this->activate();
|
||||
|
||||
if (strstr($this->title, 'circle-o')) {
|
||||
$this->title = str_replace('fa-circle-o', 'fa-dot-circle-o', $this->title);
|
||||
}
|
||||
// dump($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -14,16 +14,16 @@ class Logs
|
||||
|
||||
$menu->addTo(
|
||||
'logs', __('boilerplate::logs.menu.stats'), [
|
||||
'route' => 'boilerplate.logs.dashboard',
|
||||
'permission' => 'logs', ]
|
||||
'route' => 'boilerplate.logs.dashboard',
|
||||
'permission' => 'logs', ]
|
||||
)
|
||||
->order(1110)
|
||||
->activeIfRoute('boilerplate.logs.dashboard');
|
||||
|
||||
$menu->addTo(
|
||||
'logs', __('boilerplate::logs.menu.reports'), [
|
||||
'route' => 'boilerplate.logs.list',
|
||||
'permission' => 'logs', ]
|
||||
'route' => 'boilerplate.logs.list',
|
||||
'permission' => 'logs', ]
|
||||
)
|
||||
->order(1120)
|
||||
->activeIfRoute(['boilerplate.logs.list', 'boilerplate.logs.show', 'boilerplate.logs.filter']);
|
||||
|
||||
@@ -9,21 +9,22 @@ class Menu extends LavaryMenu
|
||||
{
|
||||
public function make($name, $callback)
|
||||
{
|
||||
if (!is_callable($callback)){
|
||||
return;}
|
||||
if (!array_key_exists($name, $this->menu)) {
|
||||
$this->menu[$name] = new Builder($name, $this->loadConf($name));
|
||||
}
|
||||
|
||||
// Registering the items
|
||||
call_user_func($callback, $this->menu[$name]);
|
||||
|
||||
// Storing each menu instance in the collection
|
||||
$this->collection->put($name, $this->menu[$name]);
|
||||
|
||||
// Make the instance available in all views
|
||||
View::share($name, $this->menu[$name]);
|
||||
|
||||
return $this->menu[$name];
|
||||
if (! is_callable($callback)) {
|
||||
return;
|
||||
}
|
||||
if (! array_key_exists($name, $this->menu)) {
|
||||
$this->menu[$name] = new Builder($name, $this->loadConf($name));
|
||||
}
|
||||
|
||||
// Registering the items
|
||||
call_user_func($callback, $this->menu[$name]);
|
||||
|
||||
// Storing each menu instance in the collection
|
||||
$this->collection->put($name, $this->menu[$name]);
|
||||
|
||||
// Make the instance available in all views
|
||||
View::share($name, $this->menu[$name]);
|
||||
|
||||
return $this->menu[$name];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,22 +14,22 @@ class Users
|
||||
|
||||
$menu->addTo(
|
||||
'access', __('boilerplate::users.list.title'), [
|
||||
'route' => 'boilerplate.users.index',
|
||||
'permission' => 'users_crud', ]
|
||||
'route' => 'boilerplate.users.index',
|
||||
'permission' => 'users_crud', ]
|
||||
)
|
||||
->activeIfRoute(['boilerplate.users.index', 'boilerplate.users.edit']);
|
||||
|
||||
$menu->addTo(
|
||||
'access', __('boilerplate::users.create.title'), [
|
||||
'route' => 'boilerplate.users.create',
|
||||
'permission' => 'users_crud', ]
|
||||
'route' => 'boilerplate.users.create',
|
||||
'permission' => 'users_crud', ]
|
||||
)
|
||||
->activeIfRoute('boilerplate.users.create');
|
||||
|
||||
$menu->addTo(
|
||||
'access', __('boilerplate::layout.role_management'), [
|
||||
'route' => 'boilerplate.roles.index',
|
||||
'permission' => 'roles_crud', ]
|
||||
'route' => 'boilerplate.roles.index',
|
||||
'permission' => 'roles_crud', ]
|
||||
)
|
||||
->activeIfRoute('boilerplate.roles.*');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user