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