本文整理汇总了PHP中Feedback::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Feedback::create方法的具体用法?PHP Feedback::create怎么用?PHP Feedback::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feedback
的用法示例。
在下文中一共展示了Feedback::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('feedbacks')->delete();
Feedback::create(array('title' => '好坑爹啊', 'content' => '不会治病学别人当什么医生', 'user_id' => 1));
Feedback::create(array('title' => '超赞', 'content' => '好棒哦', 'user_id' => 2));
Feedback::create(array('title' => '一般般', 'content' => '阿西吧~~~~', 'user_id' => 3));
Feedback::create(array('title' => '不错', 'content' => '这家医院不错哦', 'user_id' => 4));
}
示例2: post
/**
*
* Param: productId
*
* @return Response
*/
public function post($id)
{
$input = Input::all();
$sessionId = Common::checkSessionLogin($input);
$inputFeedback = ['product_id' => $id, 'user_id' => $input['user_id'], 'message' => $input['message'], 'status' => ACTIVE];
Feedback::create($inputFeedback)->id;
return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
}
示例3: run
public function run()
{
Feedback::create(['product_id' => '1', 'user_id' => '2', 'message' => 'message test 1', 'status' => '1']);
Feedback::create(['product_id' => '1', 'user_id' => '3', 'message' => 'message test 2', 'status' => '1']);
Feedback::create(['product_id' => '2', 'user_id' => '2', 'message' => 'message test 3', 'status' => '1']);
Feedback::create(['product_id' => '2', 'user_id' => '3', 'message' => 'message test 4', 'status' => '1']);
Feedback::create(['product_id' => '3', 'user_id' => '2', 'message' => 'message test 5', 'status' => '1']);
Feedback::create(['product_id' => '1', 'user_id' => '3', 'message' => 'message test 6', 'status' => '1']);
}
示例4: postContact
public function postContact()
{
$rules = array('name' => 'required', 'number' => 'required', 'email' => 'required', 'message' => 'required');
$v = Validator::make(Input::all(), $rules);
if ($v->fails()) {
App::abort(403, 'Unauthorized action.');
}
Feedback::create(Input::all());
}
示例5: run
public function run()
{
$faker = Faker::create();
$usersIds = User::lists('id');
$stars = array(1, 2, 3, 4, 5);
foreach (range(1, 10) as $index) {
Feedback::create(['user_id' => $faker->randomElement($usersIds, $count = 1), 'rating' => $faker->randomElement($stars), 'content' => $faker->text($maxNbChars = 150), 'created_at' => $faker->dateTimeBetween($startDate = '-1 years', $endDate = 'now')]);
}
}
示例6: saveFeedback
public function saveFeedback()
{
$validator = Feedback::validate($data = Input::all());
if ($validator->fails()) {
return Response::json(['valid' => false, 'errors' => $validator->errors()]);
}
Feedback::create($data);
return Response::json(['valid' => true, 'message' => Lang::get('larabase.feedback_submitted')]);
Event::fire('feedback.submitted', [$data]);
}
示例7: doSubmit
/**
* @param array $data
* @param Form $form
*
* @return mixed
*/
public function doSubmit($data, $form)
{
$controller = Controller::curr();
$redirect = Director::baseURL() . $this->owner->URLSegment;
if ((bool) Config::inst()->get('QuickFeedbackExtension', 'redirect_field') && isset($data['Redirect']) && Director::is_site_url($data['Redirect'])) {
$redirect = Director::absoluteURL($data['Redirect'], true);
}
if (!$controller) {
goto error;
}
$request = $controller->getRequest();
if (!$request) {
goto error;
}
$limit = (int) Config::inst()->get('QuickFeedbackExtension', 'rate_limit');
$existing = Feedback::get()->filter('IP', $request->getIP())->sort('Created desc')->first();
if ($existing) {
$created = $existing->dbObject('Created');
if (!$created) {
goto error;
}
$seconds = abs(time() - strtotime($created->getValue()));
$minutes = round($seconds / 60);
if ($minutes <= $limit) {
goto rate;
}
}
$feedback = Feedback::create();
$feedback->Rating = $data['Rating'];
$feedback->Comment = $data['Comment'];
$feedback->IP = $request->getIP();
if (!empty($this->owner->ID)) {
$feedback->PageID = $this->owner->ID;
}
if (!empty($this->owner->URLSegment)) {
$feedback->URL = $this->owner->RelativeLink();
}
if ((bool) Config::inst()->get('QuickFeedbackExtension', 'redirect_field') && isset($data['Redirect'])) {
$feedback->URL = $data['Redirect'];
}
$feedback->write();
$form->sessionMessage(_t('QuickFeedback.ThanksMessage', 'Thanks for your comment!'), 'good');
return $this->owner->redirect($redirect . '?success=1');
error:
$form->sessionMessage(_t('QuickFeedback.ErrorMessage', 'An error occurred!'), 'error');
return $this->owner->redirect($redirect . '?error=1');
rate:
$form->sessionMessage(_t('QuickFeedback.RateMessage', 'Please wait a while before submitting!'), 'error');
return $this->owner->redirect($redirect . '?rate=1');
}