Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Update Authors view Action
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasramy committed Jun 17, 2012
1 parent 3c2701b commit 74182a2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/controllers/AuthorsController.php
Expand Up @@ -7,17 +7,29 @@
*/

namespace app\controllers;
use \app\models\Author;
use \app\models\Authors;

class AuthorsController extends \lithium\action\Controller {

public function index() {
$authors = Authors::all();
return compact('authors');
}

public function view($id = null) {
if (!$id) {
public function login() {
}

public function logout() {
}

public function view() {
$conditions = array('Authors.id' => $this->request->id);
$with = array('Books');
$author = Authors::find('first', compact('conditions', 'with'));
if (!$author) {
$this->redirect('Authors::index');
}
return compact('author');
}

public function add() {
Expand Down

0 comments on commit 74182a2

Please sign in to comment.