public static function menu() { $new_sub = array(); foreach (Newtypes::all() as $val) { $new_sub[$val->id]['name'] = $val->name; $new_sub[$val->id]['val'] = Post::where('category', '=', $val->id)->take(10)->get(); } return $new_sub; }
{{ Form::close() }} <!-- show the nerd (uses the show method found at GET /nerds/{id} --> <a class="btn btn-small btn-success" href="{{ URL::to('posts/' . $value->id) }}">Xem</a> <!-- edit this nerd (uses the edit method found at GET /nerds/{id}/edit --> <a class="btn btn-small btn-info" href="{{ URL::to('posts/' . $value->id . '/edit') }}">Sủa</a> </td> </tr> @endforeach </tbody> </table> </div> </div> <script> $(document).ready(function(){ $('#example').dataTable({ responsive: true }).columnFilter({ aoColumns: [ null, { type: "text" }, { type: "select", values: [<?php foreach (Newtypes::all() as $val) { echo "'" . $val->name . "',"; } ?> ] } ] }); }); </script> @stop
/** * Display a listing of the resource. * * @return Response */ public function index() { $newtypes = Newtypes::all(); return View::make('backend.newtypes.index')->with('newtypes', $newtypes); }