예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //$faker = Faker\Factory::create();
     $captions = new ArrayIterator(array('captions' => 'Home', 'About Us', 'Our Services', 'Powerhouses', 'Press Release', 'Contact Us'));
     $i = 1;
     foreach ($captions as $caption) {
         \App\menu::create(['caption' => $caption, 'parent_id' => 0, 'order' => $i, 'status' => true]);
         $i++;
     }
     \App\menu::create(['caption' => 'Organization', 'parent_id' => 2, 'order' => 1, 'status' => true]);
     \App\menu::create(['caption' => 'Board of Directors', 'parent_id' => 2, 'order' => 2, 'status' => true]);
     \App\menu::create(['caption' => 'History', 'parent_id' => 2, 'order' => 3, 'status' => true]);
     \App\menu::create(['caption' => 'Electrification', 'parent_id' => 3, 'order' => 1, 'status' => true]);
     \App\menu::create(['caption' => 'Billing & Payment', 'parent_id' => 3, 'order' => 2, 'status' => true]);
     \App\menu::create(['caption' => 'Others', 'parent_id' => 3, 'order' => 3, 'status' => true]);
     \App\menu::create(['caption' => 'Grater Male', 'parent_id' => 4, 'order' => 1, 'status' => true]);
     \App\menu::create(['caption' => 'Kaaf Atoll', 'parent_id' => 4, 'order' => 2, 'status' => true]);
     \App\menu::create(['caption' => 'Alif Alif Atoll', 'parent_id' => 4, 'order' => 3, 'status' => true]);
 }
예제 #2
0
 public function deleteItem($id)
 {
     $item = \App\ItemMenu::find($id);
     $menu = \App\menu::find($item->id_menu);
     $item->path = "";
     $item->save();
     Session::flash('message', 'Imagen Eliminada Correctamente');
     return view('itemmenu.itemmenuform', ['item' => $item, 'menu' => $menu]);
 }
예제 #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $todo = menu::findorfail($id);
     $todo->update(Request::all());
     return $todo;
 }
예제 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     menu::destroy($id);
     return Redirect::route('admin.menus.index');
 }
예제 #5
0
<h2>Sub Menus</h2>

<?php 
$ms = \App\menu::all();
$subCount = 0;
?>
<ul>
@foreach($ms as $sub)
    @if($sub->parent_id == $menu->id)
            <?php 
$subCount++;
?>
            <li>
        {!! link_to_route('admin.menus.edit', $sub->caption, array($sub->id)) !!}
            </li>
        @endif

@endforeach
    @if($subCount<1)
        <li><i>No Sub Menus available. </i></li>
    @endif
</ul>