app/Http/Controllers/EmployeeController.php
/**
   * When we create a new menu item - we check weight of all existing menu items
   * and make new one the last one
   * @param $slider
   */
When we create a new menu item - we check weight of all existing menu items
and make new one the last one
@param $slider
When we create a new menu item - we check weight of all existing menu items and make new one the last one @param $slider
private function maximizeWeight($employee){
    $weight = \DB::table('employees')
      ->select('weight')
      ->orderBy('weight', 'desc')
      ->limit(1)
      ->get();
    if(isset($weight[0])){
      $employee->weight = $weight[0]->weight + 1;
    }
  }
private function maximizeWeight ( $ employee ) { $ weight = \ DB :: table ( 'employees' ) -> select ( 'weight' ) -> orderBy ( 'weight' , 'desc' ) -> limit ( 1 ) -> get ( ) ; if ( isset ( $ weight [ 0 ] ) ) { $ employee -> weight = $ weight [ 0 ] -> weight + 1 ; } }
When we create a new menu item - we check weight of all existing menu items
 and make new one the last one
 @param $slider
When we create a new menu item - we check weight of all existing menu items and make new one the last one @param $slider