Ejemplo n.º 1
0
 /**
  * Display a listing of the Post.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $query = News::query();
     $columns = Schema::getColumnListing('$TABLE_NAME$');
     $attributes = array();
     foreach ($columns as $attribute) {
         if ($request[$attribute] == true) {
             $query->where($attribute, $request[$attribute]);
             $attributes[$attribute] = $request[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     $news = $query->get();
     return view('news.index')->with('news', $news)->with('attributes', $attributes);
 }