| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\controllers;
- use app\models\Profile;
- class ProfilesController extends \lithium\action\Controller {
- public function index() {
- $profiles = Profile::all();
- return compact('profiles');
- }
- public function view() {
- $profile = Profile::first($this->request->id);
- return compact('profile');
- }
- public function add() {
- $profile = Profile::create();
- if (($this->request->data) && $profile->save($this->request->data)) {
- $this->redirect(array('Profiles::view', 'args' => array($profile->id)));
- }
- return compact('profile');
- }
- public function edit() {
- $profile = Profile::find($this->request->id);
- if (!$profile) {
- $this->redirect('Profiles::index');
- }
- if (($this->request->data) && $profile->save($this->request->data)) {
- $this->redirect(array('Profiles::view', 'args' => array($profile->id)));
- }
- return compact('profile');
- }
- }
- ?>
|