FEATURE: add number of views in page
This commit is contained in:
@@ -50,6 +50,9 @@ class ContentPage extends Controller
|
||||
throw new \Exception('Cannot access protected resources');
|
||||
}
|
||||
|
||||
// add one new "view" for page
|
||||
$page->view();
|
||||
|
||||
// get handler
|
||||
$handler = new $page->module_handler;
|
||||
|
||||
|
||||
@@ -435,4 +435,12 @@ class Content extends Model
|
||||
// save history
|
||||
ContentHistory::create($history);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$this->timestamps = false;
|
||||
$this->viewed ++;
|
||||
$this->save();
|
||||
$this->timestamps = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user