create() public method

public create ( $postdata )
Beispiel #1
0
 public function run()
 {
     DB::table('faqs')->truncate();
     DB::table('faqs')->delete();
     for ($i = 0; $i < 20; $i++) {
         Faq::create(array('user_id' => '1', 'title' => 'Тестовый вопрос - ' . $i, 'content' => 'Тестовый ответ - ' . $i, 'active' => 1, 'meta_title' => 'Тестовый ответ мета заголовок - ' . $i, 'meta_description' => 'Тестовый вопрос мета описание - ' . $i, 'meta_keywords' => 'Тестовый вопрос ключевые слова - ' . $i, 'published_at' => '2015-01-28 16:50:01'));
     }
 }
 public function store()
 {
     $input = Input::only('question', 'answer');
     if ($input['question'] != null) {
         $faq = Faq::create($input);
         return $faq;
     } else {
         App::abort(500, 'Question was not saved');
     }
 }
Beispiel #3
0
 public function post_add()
 {
     $input = Input::get();
     $rules = array('question' => 'required', 'answer' => 'required');
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         $faq = Faq::create(Input::get());
         return Redirect::to('rms/faqs')->with('success', 'Successfully Added New faq');
     } else {
         return Redirect::to('rms/faqs/add/')->withErrors($validation)->withInput();
     }
 }
Beispiel #4
0
 public function create($request)
 {
     $req = $request->getParameters();
     $data = [];
     $new_question = ['timestamp' => Utils::tps()];
     foreach (self::$fields as $field) {
         $new_question[$field] = isset($req[$field]) ? $req[$field] : 0;
     }
     $faq = Faq::create($new_question);
     $r = $this->edit($faq->id, $request);
     $r->addMessage(ViewMessage::success("Nouvelle Question/Réponse créée. <a href=\"" . WEBROOT . "admin/faq\">Retour à la liste</a>"));
     return $r;
 }
Beispiel #5
0
     break;
 case validateRoute('PATCH', 'rules/\\d+'):
     $rules = new Rules($db, $user);
     httpResponse($rules->update($params[1], $postdata));
     break;
 case validateRoute('DELETE', 'rules/\\d+'):
     $rules = new Rules($db, $user);
     httpResponse($rules->delete($params[1]));
     break;
 case validateRoute('GET', 'faq'):
     $faq = new Faq($db, $user);
     httpResponse($faq->query());
     break;
 case validateRoute('POST', 'faq'):
     $faq = new Faq($db, $user);
     httpResponse($faq->create($postdata));
     break;
 case validateRoute('PATCH', 'faq/\\d+'):
     $faq = new Faq($db, $user);
     httpResponse($faq->update($params[1], $postdata));
     break;
 case validateRoute('DELETE', 'faq/\\d+'):
     $faq = new Faq($db, $user);
     httpResponse($faq->delete($params[1]));
     break;
 case validateRoute('GET', 'polls'):
     $polls = new Polls($db, $user);
     httpResponse($polls->query());
     break;
 case validateRoute('GET', 'polls/latest'):
     $polls = new Polls($db, $user);