public function get_pages($action = null, $id = null) { if (!is_null($action)) { $fn = 'get_' . $action; return $this->{$fn}($id); } $pages = Page::latest()->paginate(10); $pages_count = Page::count(); $title = 'Administrayon Paj (' . $pages_count . ')'; return View::make('admin.pages.index')->withTitle($title)->withPages($pages)->withPagesCount($pages_count); }