本文整理汇总了PHP中Submission::create_submission方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::create_submission方法的具体用法?PHP Submission::create_submission怎么用?PHP Submission::create_submission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submission
的用法示例。
在下文中一共展示了Submission::create_submission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_results
/**
* This function is responsible for displaying the results page.
*
* It first sends data to the model for insertion into database.
* If inserted correctly, displays the results page.
*/
public function get_results()
{
if (!($id = Route::input('id'))) {
Log::error('Unable to display results. Route ID not found.');
return Redirect::to('error');
}
if (!($answers = Session::get('answers'))) {
Log::error('Unable to display results. Unable to retreive answers from session.');
return Redirect::to('error');
}
if (!($restart = route('home'))) {
Log::error('Unable to assign the restart button to a route.');
return Redirect::to('error');
}
$responses = self::clean_results($answers);
$submission = self::prepare_submission($id, $answers);
if (Submission::create_submission($submission)) {
return View::make('results', array('heading' => 'Thank you! Your outcome is provided below', 'outcome' => self::$outcomes[$id], 'responses' => $responses, 'restart' => $restart));
}
Log::error('Unable to create submission. Database insertion failed');
return Redirect::to('error');
}