-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp_model.php
More file actions
executable file
·50 lines (47 loc) · 1.31 KB
/
app_model.php
File metadata and controls
executable file
·50 lines (47 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Application model for Cake.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppModel extends Model {
var $recursive = -1;
var $actsAs = array('Containable');
/**
* Run this during beforeSave() to set the currently logged in user as the owner of the record
*/
function owner() {
if (!isset($this->data[$this->name]['id'])) {
$this->data[$this->name]['user_id'] = User::get('id');
return true;
} else {
return false;
}
}
}
?>