app/Http/Controllers/IndexController.php
/**
   * universal method for ajax Load more functionality
   */
universal method for ajax Load more functionality
universal method for ajax Load more functionality
public function ajax_more(Request $request){
    if($request->relatedType == 'news'){
      $material = News::find($request->relatedId);
      $relatedNews = $material->getRelatedNews();
    }
    elseif($request->relatedType == 'child'){
      $material = ChildPage::find($request->relatedId);
      $relatedNews = $material->getRelatedNews();
    }
    elseif($request->relatedType == 'objava'){
      $material = Advert::find($request->relatedId);
      $relatedNews = $material->getRelatedNews();
    }
    $left = $request->relatedLeft - 2;
    $html = $this->buildMoreHtml($request, $relatedNews);
    $response = array(
      'status' => 'success',
      'html' => $html,
      'left' => $left
    );
    return \Response::json($response);
  }
public function ajax_more ( Request $ request ) { if ( $ request -> relatedType == 'news' ) { $ material = News :: find ( $ request -> relatedId ) ; $ relatedNews = $ material -> getRelatedNews ( ) ; } elseif ( $ request -> relatedType == 'child' ) { $ material = ChildPage :: find ( $ request -> relatedId ) ; $ relatedNews = $ material -> getRelatedNews ( ) ; } elseif ( $ request -> relatedType == 'objava' ) { $ material = Advert :: find ( $ request -> relatedId ) ; $ relatedNews = $ material -> getRelatedNews ( ) ; } $ left = $ request -> relatedLeft - 2 ; $ html = $ this -> buildMoreHtml ( $ request , $ relatedNews ) ; $ response = array ( 'status' => 'success' , 'html' => $ html , 'left' => $ left ) ; return \ Response :: json ( $ response ) ; }
universal method for ajax Load more functionality
universal method for ajax Load more functionality