public function postUpdate(Request $request, $id)
 {
     $validator = Validator::make($request->all(), ['title' => 'required|alpha|unique:menus,title,' . $id]);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $model = $this->model->find($id);
     $model->update($request->all());
     return Site::redirectAction('index');
 }
 public function postUpdate(Request $request, $id)
 {
     $model = Role::find($id);
     $validator = Validator::make($request->all(), $model->rules());
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $model->update($request->all());
     \Session::flash('message', 'Data Has Been Saved');
     return Site::redirectAction('index');
 }
 public function postCreate(Request $request)
 {
     $input = $request->all();
     $validator = Validator::make($request->all(), Menu::rulesValidation(), Site::errorMessages());
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     Menu::create($request->all());
     $path = app_path() . "\\Http\\Controllers\\" . $request->controller;
     $createFile = fopen($path . ".php", "w");
     $generateController = Site::generateController($request->controller);
     $write = fwrite($createFile, $generateController);
     fclose($createFile);
     return redirect(Site::routeGenerator() . "/default/index");
 }
<script type="text/javascript" src="{{ asset(null) }}public/shamcey/js/responsive-tables.js"></script>
<script type="text/javascript" src="{{ asset(null) }}public/shamcey/js/jquery.slimscroll.js"></script>
<script type="text/javascript" src="{{ asset(null) }}public/shamcey/js/custom.js"></script>

<script type="text/javascript" src="{{ asset(null) }}public/js/jquery.js"></script>
<script type="text/javascript" src="{{ asset(null) }}public/js/app.js"></script>
</head>

<body>

<div id="mainwrapper" class="mainwrapper">
    
    <div class="header">
        <div class="logo">
            <?php 
echo HTML::link(Site::routeBackend() . "/", Site::applicationName(), ['class' => 'logoObgl']);
?>
        </div>
        <div class="headerinner">
            <ul class="headmenu">
                <li class="odd">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <span class="count">4</span>
                        <span class="head-icon head-message"></span>
                        <span class="headmenu-label">Messages</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="nav-header">Messages</li>
                        <li><a href="#"><span class="icon-envelope"></span> New message from <strong>Jack</strong> <small class="muted"> - 19 hours ago</small></a></li>
                        <li><a href="#"><span class="icon-envelope"></span> New message from <strong>Daniel</strong> <small class="muted"> - 2 days ago</small></a></li>
                        <li><a href="#"><span class="icon-envelope"></span> New message from <strong>Jane</strong> <small class="muted"> - 3 days ago</small></a></li>
<?php

use oblagio\Helpers\Site;
use oblagio\Models\Menu;
$menu = Menu::where('controller', '!=', '#')->get();
Route::get(Site::routeGenerator(), 'Modules\\Obgl\\DefaultController@getIndex');
Route::get(Site::routeBackend(), 'Modules\\Backend\\DefaultController@getIndex');
Route::controller(Site::routeGenerator() . "/default", 'Modules\\Obgl\\DefaultController');
foreach ($menu as $row) {
    Route::controller(Site::routeBackend() . "/" . Site::aliasUrl($row->title), $row->controller);
}
                <?php 
$modelParent = Menu::whereParentId(0)->orderBy('order', 'asc')->get();
foreach ($modelParent as $parent) {
    if ($parent->controller == '#') {
        $cekUrl = '#';
    } else {
        $cekUrl = Site::main()['routeBackend'] . "/" . Site::aliasUrl($parent->title);
    }
    $setChild = Menu::whereParentId($parent->id)->orderBy('order', 'asc');
    $countChild = clone $setChild;
    $dropdown = $countChild->count() > 0 ? 'dropdown' : '';
    echo "<li class = '" . $dropdown . "'>";
    echo HTML::link($cekUrl, $parent->title);
    if ($countChild->count() > 0) {
        echo "<ul>";
        $modelChild = clone $setChild;
        foreach ($modelChild->get() as $child) {
            echo "<li>";
            echo HTML::link(Site::main()['routeBackend'] . "/" . Site::aliasUrl($child->title), $child->title);
            echo "</li>";
        }
        echo "</ul>";
    }
    echo "</li>";
}
?>
            </ul>
        </div><!--leftmenu-->
        
    </div><!-- leftpanel -->
                <?php 
$modelParent = Menu::whereParentId(0)->orderBy('order', 'asc')->get();
foreach ($modelParent as $parent) {
    if ($parent->controller == '#') {
        $cekUrl = '#';
    } else {
        $cekUrl = Site::routeBackend() . "/" . Site::aliasUrl($parent->title);
    }
    $setChild = Menu::whereParentId($parent->id)->orderBy('order', 'asc');
    $countChild = clone $setChild;
    $dropdown = $countChild->count() > 0 ? 'dropdown' : '';
    echo "<li class = '" . $dropdown . "'>";
    echo HTML::link($cekUrl, $parent->title);
    if ($countChild->count() > 0) {
        echo "<ul>";
        $modelChild = clone $setChild;
        foreach ($modelChild->get() as $child) {
            echo "<li>";
            echo HTML::link(Site::routeBackend() . "/" . Site::aliasUrl($child->title), $child->title);
            echo "</li>";
        }
        echo "</ul>";
    }
    echo "</li>";
}
?>
            </ul>
        </div><!--leftmenu-->
        
    </div><!-- leftpanel -->
 public static function generateLink($action, $id = "")
 {
     $generateLink = Request::segment(1) . "/" . Site::aliasUrl(Request::segment(2)) . "/" . $action . "/" . $id;
     return url(str_replace("//", "/", $generateLink));
 }
 public static function generateLink($action, $id = "")
 {
     // return url($generateLink = Site::main()['routeBackend']."/".Site::aliasUrl(Request::segment(2))."/".$action."/".$id);
     return url($generateLink = Request::segment(1) . "/" . Site::aliasUrl(Request::segment(2)) . "/" . $action . "/" . $id);
 }
<?php

use oblagio\Helpers\Site;
use oblagio\Models\Menu;
$menu = Menu::where('controller', '!=', '#')->get();
Route::get(Site::main()['routeGenerator'], 'Modules\\Obgl\\DefaultController@getIndex');
Route::get(Site::main()['routeBackend'], 'Modules\\Backend\\DefaultController@getIndex');
Route::controller(Site::main()['routeGenerator'] . "/default", 'Modules\\Obgl\\DefaultController');
foreach ($menu as $row) {
    Route::controller(Site::main()['routeBackend'] . "/" . Site::aliasUrl($row->title), $row->controller);
}