/** * GET /projects * Get a listing of all projects. * * @return Response */ public function index() { $projects = $this->project->latest()->paginate(25); $page = Input::get('page'); $title = $page ? "All projects (Page {$page})" : 'All projects'; return View::make('projects.index', compact('projects'))->withTitle($title); }
/** * testLatest method * * @return void */ public function testLatest() { $data = $this->Project->latest(array('logged' => false)); $this->assertCount(3, $data); foreach ($data as $row) { $this->assertEqual($row['Project']['is_public'], 1); } $data = $this->Project->latest(array('admin' => true)); $this->assertCount(5, $data); $this->assertEqual(Set::extract('{n}.Project.is_public', $data), array(0, 0, 1, 0, 1)); }
/** * show news * @return mixed */ public function show_news() { $projects = Project::latest()->paginate(8); return View::make('pages.news')->with(compact('projects')); }