当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::create方法代码示例

本文整理汇总了PHP中Question::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::create方法的具体用法?PHP Question::create怎么用?PHP Question::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


在下文中一共展示了Question::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Question::create(['title' => $faker->sentence(25), 'body' => $faker->realText(100), 'user_id' => rand(1, 5)]);
     }
 }
开发者ID:ayooby,项目名称:whatisit,代码行数:7,代码来源:QuestionTableSeeder.php

示例2: create

 function create()
 {
     Auth::checkLoggedIn();
     $entry = Entry::fromId(Input::get('entryid'));
     if (!$entry->canView(Auth::getUser())) {
         throw new Exception('You are not allowed to ask a question in this entry.');
     }
     $question = Question::create(Auth::getUser(), $entry, Input::get('title'), Input::get('text'), Input::getBoolean('private'));
     View::renderJson($question->getContext(Auth::getUser()));
 }
开发者ID:brandonfrancis,项目名称:scsapi,代码行数:10,代码来源:question_controller.php

示例3: run

 public function run()
 {
     DB::table('Players')->delete();
     DB::table('Questions')->delete();
     DB::table('Questionnaires')->delete();
     DB::table('Answers')->delete();
     DB::table('Level')->delete();
     $eingang = Questionnaire::create(array('name' => 'eingang'));
     $mittel = Questionnaire::create(array('name' => 'mittel'));
     $end = Questionnaire::create(array('name' => 'end'));
     $test = Questionnaire::create(array('name' => 'test'));
     $level = Level::create(array('score' => 1, 'mistakes' => 10, 'hits' => 2, 'info' => 'info'));
     $test1 = Question::create(array('question' => '1', 'questionnaire_id' => $test->id));
     $test2 = Question::create(array('question' => '2', 'questionnaire_id' => $test->id));
     $test3 = Question::create(array('question' => '3', 'questionnaire_id' => $test->id));
     $test4 = Question::create(array('question' => '4', 'questionnaire_id' => $test->id));
     $eingang1 = Question::create(array('question' => 'Ich spiele häufig Computerspiele', 'questionnaire_id' => $eingang->id));
     $eingang1 = Question::create(array('question' => 'Ich kenne die Gestaltgesetze', 'questionnaire_id' => $eingang->id));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $end->id));
     $fam1 = Question::create(array('question' => 'Ich mag solche Rätsel und Knobeleien', 'questionnaire_id' => $end->id));
     $fam15 = Question::create(array('question' => 'Ich glaube, der Schwierigkeit dieses Spiels gewachsen zu sein', 'questionnaire_id' => $end->id));
     $fam16 = Question::create(array('question' => 'Wahrscheinlich werde ich das Spiel nicht schaffen.', 'questionnaire_id' => $end->id));
     $fam1 = Question::create(array('question' => 'Bei dem Spiel mag ich die Rolle des Wissenschaftlers, der Zusammenhänge entdeckt.', 'questionnaire_id' => $end->id));
     $fam2 = Question::create(array('question' => 'Das Spiel ist eine richtige Herausforderung für mich.', 'questionnaire_id' => $end->id));
     $fam3 = Question::create(array('question' => 'Nach dem Lesen der Instruktion erscheint mir das Spiel sehr interessant.', 'questionnaire_id' => $end->id));
     $fam4 = Question::create(array('question' => 'Ich bin sehr gespannt darauf, wie gut ich hier abschneiden werde.', 'questionnaire_id' => $end->id));
     $fam5 = Question::create(array('question' => 'Ich fürchte mich ein wenig davor, dass ich mich hier blamieren könnte', 'questionnaire_id' => $end->id));
     $fam6 = Question::create(array('question' => 'Ich bin fest entschlossen, mich bei diesem Spiel voll anzustrengen.', 'questionnaire_id' => $end->id));
     $fam7 = Question::create(array('question' => 'Bei Spielen wie diesem brauche ich keine Belohnung, sie machen mir auch so viel Spaß. ', 'questionnaire_id' => $end->id));
     $fam8 = Question::create(array('question' => 'Es ist mir etwas peinlich, hier zu versagen.', 'questionnaire_id' => $end->id));
     $fam9 = Question::create(array('question' => 'Ich glaube, dass kann jeder schaffen', 'questionnaire_id' => $end->id));
     $fam10 = Question::create(array('question' => 'Ich glaube, ich schaffe dieses Spiel nicht', 'questionnaire_id' => $end->id));
     $fam11 = Question::create(array('question' => 'Wenn ich das Spiel schaffe, werde ich schon ein wenig stolz auf meine Tüchtigkeit sein.', 'questionnaire_id' => $end->id));
     $fam12 = Question::create(array('question' => 'Wenn ich an das Spiel denke, bin ich etwas beunruhigt.', 'questionnaire_id' => $end->id));
     $fam13 = Question::create(array('question' => 'Eine solches Spiel würde ich auch in meiner Freizeit spielen.', 'questionnaire_id' => $end->id));
     $fam14 = Question::create(array('question' => 'Die konkreten Leistungsanforderungen hier lähmen mich.', 'questionnaire_id' => $end->id));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $mittel->id));
     $fammid1 = Question::create(array('question' => 'Ich mag solche Rätsel und Knobeleien', 'questionnaire_id' => $mittel->id));
     $fammid15 = Question::create(array('question' => 'Ich glaube, der Schwierigkeit dieses Spiels gewachsen zu sein', 'questionnaire_id' => $mittel->id));
     $fammid16 = Question::create(array('question' => 'Wahrscheinlich werde ich das Spiel nicht schaffen.', 'questionnaire_id' => $mittel->id));
     $fammid1 = Question::create(array('question' => 'Bei dem Spiel mag ich die Rolle des Wissenschaftlers, der Zusammenhänge entdeckt.', 'questionnaire_id' => $mittel->id));
     $fammid2 = Question::create(array('question' => 'Das Spiel ist eine richtige Herausforderung für mich.', 'questionnaire_id' => $mittel->id));
     $fammid3 = Question::create(array('question' => 'Nach dem Lesen der Instruktion erscheint mir das Spiel sehr interessant.', 'questionnaire_id' => $mittel->id));
     $fammid4 = Question::create(array('question' => 'Ich bin sehr gespannt darauf, wie gut ich hier abschneiden werde.', 'questionnaire_id' => $mittel->id));
     $fammid5 = Question::create(array('question' => 'Ich fürchte mich ein wenig davor, dass ich mich hier blamieren könnte', 'questionnaire_id' => $mittel->id));
     $fammid6 = Question::create(array('question' => 'Ich bin fest entschlossen, mich bei diesem Spiel voll anzustrengen.', 'questionnaire_id' => $mittel->id));
     $fammid7 = Question::create(array('question' => 'Bei Spielen wie diesem brauche ich keine Belohnung, sie machen mir auch so viel Spaß. ', 'questionnaire_id' => $mittel->id));
     $fammid8 = Question::create(array('question' => 'Es ist mir etwas peinlich, hier zu versagen.', 'questionnaire_id' => $mittel->id));
     $fammid9 = Question::create(array('question' => 'Ich glaube, dass kann jeder schaffen', 'questionnaire_id' => $mittel->id));
     $fammid10 = Question::create(array('question' => 'Ich glaube, ich schaffe dieses Spiel nicht', 'questionnaire_id' => $mittel->id));
     $fammid11 = Question::create(array('question' => 'Wenn ich das Spiel schaffe, werde ich schon ein wenig stolz auf meine Tüchtigkeit sein.', 'questionnaire_id' => $mittel->id));
     $fammid12 = Question::create(array('question' => 'Wenn ich an das Spiel denke, bin ich etwas beunruhigt.', 'questionnaire_id' => $mittel->id));
     $fammid13 = Question::create(array('question' => 'Eine solches Spiel würde ich auch in meiner Freizeit spielen.', 'questionnaire_id' => $mittel->id));
     $fammid14 = Question::create(array('question' => 'Die konkreten Leistungsanforderungen hier lähmen mich.', 'questionnaire_id' => $mittel->id));
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:55,代码来源:DatabaseSeeder.php

示例4: run

 public function run()
 {
     DB::table('Players')->delete();
     DB::table('Questions')->delete();
     DB::table('Questionnaires')->delete();
     DB::table('Answers')->delete();
     $kim = Questionnaire::create(array('name' => 'kim'));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $kim->id));
     $playerJustus = Player::create(array('gender' => 'm', 'age' => '21', 'computer' => '4', 'game' => '3', 'questionnaire_id' => $kim->id));
     $Testfrage = Answer::create(array('answer' => 'Test', 'player_id' => $playerJustus->id, 'question_id' => $frage1->id));
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:11,代码来源:DatabaseSeeder.php

示例5: postNew

 /**
  * Post method to process the form
  **/
 public function postNew()
 {
     //first, let's validate the form
     $validation = Validator::make(Input::all(), Question::$add_rules);
     if ($validation->passes()) {
         //First, let's create the question
         $create = Question::create(array('userID' => Sentry::getUser()->id, 'title' => Input::get('title'), 'question' => Input::get('question')));
         //We get the insert id of the question
         $insert_id = $create->id;
         //Now, we need to re-find the question to "attach" the tag to the question
         $question = Question::find($insert_id);
         //Now, we should check if tags column is filled, and split the string and add a new tag and a relation
         if (Str::length(Input::get('tags'))) {
             //let's explode all tags from the comma
             $tags_array = explode(',', Input::get('tags'));
             //if there are any tags, we will check if they are new, if so, we will add them to database
             //After checking the tags, we will have to "attach" tag(s) to the new question
             if (count($tags_array)) {
                 foreach ($tags_array as $tag) {
                     //first, let's trim and get rid of the extra space bars between commas
                     //(tag1, tag2, vs tag1,tag2)
                     $tag = trim($tag);
                     //We should double check its length, because the user may have just typed "tag1,,tag2" (two or more commas) accidentally
                     //We check the slugged version of the tag, because tag string may only be meaningless character(s), like "tag1,+++//,tag2"
                     if (Str::length(Str::slug($tag))) {
                         //the URL-Friendly version of the tag
                         $tag_friendly = Str::slug($tag);
                         //Now let's check if there is a tag with the url friendly version of the provided tag already in our database:
                         $tag_check = Tag::where('tagFriendly', $tag_friendly);
                         //if the tag is a new tag, then we will create a new one
                         if ($tag_check->count() == 0) {
                             $tag_info = Tag::create(array('tag' => $tag, 'tagFriendly' => $tag_friendly));
                             //If the tag is not new, this means There was a tag previously added on the same name to another question previously
                             //We still need to get that tag's info from our database
                         } else {
                             $tag_info = $tag_check->first();
                         }
                     }
                     //Now the attaching the current tag to the question
                     $question->tags()->attach($tag_info->id);
                 }
             }
         }
         //lastly, we should return the user to the asking page with a permalink of the question
         return Redirect::route('ask')->with('success', 'Your question has been created successfully! ' . HTML::linkRoute('question_details', 'Click here to see your question', array('id' => $insert_id, 'title' => Str::slug($question->title))));
     } else {
         return Redirect::route('ask')->withInput()->with('error', $validation->errors()->first());
     }
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:52,代码来源:QuestionController.php

示例6: getCreate

 public function getCreate()
 {
     $validator = Validator::make(Input::all(), array('questionTitle' => 'required|max:155', 'question' => 'max:655'));
     if ($validator->fails()) {
         return Redirect::route('ask-question')->withErrors($validator)->withInput();
     } else {
         $questionTitle = Input::get('questionTitle');
         $question = Input::get('question');
         $user_id = Auth::user()->user_id;
         $singlequestion = Question::create(array('user_id' => $user_id, 'questiontitle' => $questionTitle, 'question' => $question));
         $insertPoint = User::find($user_id);
         $insertPoint->points = $insertPoint->points + 5;
         $insertPoint->save();
         return Redirect::route('home')->with('global', 'Your Question Successfully Submitted');
     }
 }
开发者ID:AnwarAbir18,项目名称:mushkil-asan,代码行数:16,代码来源:QuestionController.php

示例7: updatePoll

 public function updatePoll()
 {
     $poll_title = Input::get('poll_title');
     $poll_id = Input::get('poll_id');
     $new_poll_questions = Input::get('new_poll_questions');
     $new_poll_questions_count = count($new_poll_questions);
     $poll = Poll::find($poll_id);
     if (isset($poll_title)) {
         $poll->title = $poll_title;
         $poll->save();
     }
     for ($i = 0; $i < $new_poll_questions_count; $i++) {
         if (isset($new_poll_questions[$i])) {
             $question = Question::create(array('created_by' => Auth::user()->id, 'content' => $new_poll_questions[$i], 'poll_id' => $poll_id));
             $question->save();
         }
     }
     foreach ($poll->questions as $question) {
         $save_question = Question::find($question->id);
         $save_question->content = Input::get('question-' . $question->id);
         $save_question->save();
         foreach ($question->answers as $answer) {
             $save_answer = Answer::find($answer->id);
             $save_answer->content = Input::get('answer-' . $answer->id);
             $save_answer->save();
         }
         $new_poll_answers = Input::get('new_poll_answers-' . $question->id);
         if (isset($new_poll_answers)) {
             $new_poll_answers_count = count($new_poll_answers);
             for ($i = 0; $i < $new_poll_answers_count; $i++) {
                 if (isset($new_poll_answers[$i])) {
                     $answer = Answer::create(array('created_by' => Auth::user()->id, 'content' => $new_poll_answers[$i], 'question_id' => $question->id));
                     $answer->save();
                 }
             }
         }
     }
     return Redirect::action('PollController@editPoll', array('title' => $poll_title));
     //	return View::make('edit-poll')
     //			->with('poll',$poll);
 }
开发者ID:netintelpro,项目名称:laravel-app,代码行数:41,代码来源:PollController.php

示例8: update

 /**
  * PUT request, we're using it here to mean 'replace the record with'
  */
 public function update($id)
 {
     $v = Validator::make(Input::all(), ['name' => 'required|string', 'questions' => 'array', 'taggable' => 'array']);
     if ($v->fails()) {
         return Response::json($v->errors(), 400);
     }
     $questionnaire = Questionnaire::find($id);
     if (is_null($questionnaire)) {
         return Response::json(['error' => 'no such questionnaire found'], 404);
     }
     $questionIds = $questionnaire->questions->lists('id');
     Question::destroy($questionIds);
     if (Input::has('questions')) {
         foreach (Input::get('questions') as $question) {
             Question::create(['question' => $question, 'questionnaire_id' => $questionnaire->id]);
         }
     }
     $tagListIds = $questionnaire->tagLists->lists('id');
     $questionnaire->tagLists()->detach($tagListIds);
     if (Input::has('taggable')) {
         foreach (Input::get('taggable') as $tagList) {
             $T = TagList::firstOrNew(['name' => $tagList['name']]);
             $questionnaire->tagLists()->save($T);
             if (!$T->exists) {
                 // it's a new one!
                 $T->save();
             }
         }
     }
     $questionnaire->name = Input::get('name');
     $questionnaire->touch();
     $questionnaire->push();
     // if these are modified they won't be shown...
     $questionnaire->load('tagLists', 'tagLists.tags', 'questions');
     return Response::json($this->reformatTagsAndQuestions($questionnaire), 200);
 }
开发者ID:mymedialab,项目名称:listenings,代码行数:39,代码来源:QuestionnaireController.php

示例9: pathinfo

        if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") {
            $type = "image";
        } else {
            if ($ext == "mp4" || $ext == "3gp" || $ext == "wmv" || $ext == "flv") {
                $type = "video";
            } else {
                if ($ext == "mp3" || $ext == "wav" || $ext == "aac") {
                    $type = "audio";
                }
            }
        }
    }
    $question->type = $type;
    $question->points = $_POST['points'];
    $question->timer = $_POST['timer'];
    $question->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $question = Question::get_by_id($_POST['id']);
        $question->group_id = $session->user_group_id;
        $question->text = $_POST['text'];
        $question->difficulty = $_POST['difficulty'];
        $question->answer = $_POST['answer'];
        $question->choice_a = $_POST['choice_a'];
        $question->choice_b = $_POST['choice_b'];
        $question->choice_c = $_POST['choice_c'];
        $question->file = $_POST['file'];
        $type = "text";
        if (!empty($question->file)) {
            $ext = pathinfo($question->file, PATHINFO_EXTENSION);
            if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") {
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:31,代码来源:update_question.php

示例10: insertTkByName

 /**
  * 用于上传EPQA, CPI, SCL 三个数据库
  * @param unknown $name
  * @param unknown $data
  * @throws Exception
  * @return boolean
  */
 public static function insertTkByName($name, $data)
 {
     if (self::dataFormatCheck($data) != 5 || self::dataFormatCheck($name) != 1) {
         throw new Exception("input type is not available");
     }
     $name = strtoupper(trim($name));
     $number = null;
     switch ($name) {
         case 'EPQA':
             $number = 88;
             $options = "是|不是";
             break;
         case 'CPI':
             $number = 230;
             $options = "是|否";
             break;
         case 'SCL':
             $number = 90;
             $options = "没有|很轻|中等|偏重|严重";
             break;
         default:
             throw new Exception("no this Type data");
     }
     $paper_data = Paper::getListByName($name);
     if (isset($paper_data->id)) {
         $paper_id = intval($paper_data->id);
         $question_data = Question::getQuestionsByPaperId($paper_id);
         $question_data_count = count($question_data);
         if ($question_data_count == $number) {
             throw new Exception("The {$name} data has already inserted, don't do again!");
         } else {
             if ($question_data_count != 0) {
                 throw new Exception("The DB data for {$name} may be ERROR!");
             } else {
                 try {
                     $manager = new TxManager();
                     $transaction = $manager->get();
                     foreach ($data as $record) {
                         $scl_question = new Question();
                         $scl_question->topic = $record[1];
                         $scl_question->number = intval($record[0]);
                         $scl_question->options = $options;
                         $scl_question->paper_id = $paper_id;
                         if ($scl_question->create() == false) {
                             $transaction->rollback("Cannot insert {$name} data");
                         }
                     }
                     $transaction->commit();
                     return true;
                 } catch (TxFailed $e) {
                     throw new Exception("Failed, reason: " . $e->getMessage());
                 }
             }
         }
     } else {
         return false;
     }
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:65,代码来源:DBHandle.php

示例11: run

 public function run()
 {
     /******************************************************************************
      * --- Test ---
      ******************************************************************************/
     Test::create(array('name' => 'BURNOUT', 'idTestType' => '2'));
     /******************************************************************************
      * --- Escalas ---
      ******************************************************************************/
     Scale::create(array('idTest' => '4', 'description' => 'Reducida Sensación'));
     Scale::create(array('idTest' => '4', 'description' => 'Agotamiento'));
     Scale::create(array('idTest' => '4', 'description' => 'Devaluación'));
     /******************************************************************************
      * --- Rangos Posibles ---
      ******************************************************************************/
     Range::create(array('description' => 'Bajo', 'min' => '5.0', 'max' => '11.0'));
     Range::create(array('description' => 'Medio', 'min' => '12.0', 'max' => '18.0'));
     Range::create(array('description' => 'Alto', 'min' => '19.0', 'max' => '25.0'));
     /******************************************************************************
      * --- Rangos por Escala ---
      ******************************************************************************/
     // Reducida Sensación
     ScaleRange::create(array('idScale' => '12', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '12', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '12', 'idRange' => '12'));
     // Agotamiento
     ScaleRange::create(array('idScale' => '13', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '13', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '13', 'idRange' => '12'));
     // Devaluación
     ScaleRange::create(array('idScale' => '14', 'idRange' => '10'));
     ScaleRange::create(array('idScale' => '14', 'idRange' => '11'));
     ScaleRange::create(array('idScale' => '14', 'idRange' => '12'));
     /******************************************************************************
      * --- Grupos ---
      ******************************************************************************/
     Group::create(array());
     // Burnout (orden normal) Con id = 5
     Group::create(array());
     // Burnout (orden inverso) Con id = 6
     /******************************************************************************
      * --- Posibles Respuestas ---
      ******************************************************************************/
     // --- BURNOUT (orden normal) ---
     TestAnswer::create(array('number' => '1', 'description' => 'Casi nunca', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '2', 'description' => 'Pocas veces', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '3', 'description' => 'Algunas veces', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '4', 'description' => 'A menudo', 'idGroup' => '5'));
     TestAnswer::create(array('number' => '5', 'description' => 'Casi siempre', 'idGroup' => '5'));
     // --- BURNOUT (orden inverso) ---
     TestAnswer::create(array('number' => '5', 'description' => 'Casi nunca', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '4', 'description' => 'Pocas veces', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '3', 'description' => 'Algunas veces', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '2', 'description' => 'A menudo', 'idGroup' => '6'));
     TestAnswer::create(array('number' => '1', 'description' => 'Casi siempre', 'idGroup' => '6'));
     /******************************************************************************
      * --- Preguntas ---
      ******************************************************************************/
     $burnout = '4';
     $reducidaSensacion = '12';
     $agotamiento = '13';
     $devaluacion = '14';
     $grupoBurnoutNormal = '5';
     $grupoBurnoutInverso = '6';
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '1', 'description' => 'Siento que estoy logrando muchas cosas que valen la pena en mi deporte.', 'idGroup' => $grupoBurnoutInverso));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '2', 'description' => 'Me siento tan cansado de mis entrenamientos que tengo problemas al encontrar energía para hacer otras cosas.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '3', 'description' => 'El esfuerzo y tiempo que dedico a mi deporte estaría mejor invertido realizando otras actividades más productivas.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '4', 'description' => 'Me siento demasiado cansado debido a mis actividades en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '5', 'description' => 'No estoy consiguiendo logros importantes en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '6', 'description' => 'No me importa tanto mi rendimiento en mi deporte como antes.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '7', 'description' => 'No estoy rindiendo de acuerdo a mi verdadera capacidad en mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '8', 'description' => 'Me siento "desgastado" física y emocionalmente por debido a mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '9', 'description' => 'No estoy tan interesado en mi deporte como acostumbraba hacerlo antes.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '10', 'description' => 'Me siento físicamente agotado por debido a mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '11', 'description' => 'Me siento menos preocupado por tener éxito en mi deporte de lo que solía hacerlo.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $agotamiento, 'number' => '12', 'description' => 'Estoy agotado por las exigencias físicas y mentales de mi deporte.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '13', 'description' => 'Parece que no importa lo que haga, no logro rendir tan bien como podría hacerlo.', 'idGroup' => $grupoBurnoutNormal));
     Question::create(array('idTest' => $burnout, 'idScale' => $reducidaSensacion, 'number' => '14', 'description' => 'Me siento exitoso en mi deporte.', 'idGroup' => $grupoBurnoutInverso));
     Question::create(array('idTest' => $burnout, 'idScale' => $devaluacion, 'number' => '15', 'description' => 'Tengo sentimientos y pensamientos negativos hacia mi deporte.', 'idGroup' => $grupoBurnoutNormal));
 }
开发者ID:ebuzz,项目名称:SAPE_CAR,代码行数:80,代码来源:DatabaseSeeder.php

示例12: postSave

 public function postSave()
 {
     $postData = Input::all();
     if ($postData['formOrigin'] == "edit") {
         $rules = array('topic' => 'required', 'correct_answer' => 'required');
         $validator = Validator::make($postData, $rules);
         if ($validator->fails()) {
             return Redirect::to('backends/quizz/edit/' . $postData['id'])->withInput()->withErrors($validator);
         } else {
             $question = Question::find($postData['id']);
             $question->topic = $postData['topic'];
             $question->correct_answer = $postData['correct_answer'];
             $question->save();
             return Redirect::to('backends/quizz/edit/' . $question->id);
         }
     } else {
         $rules = array('topic' => 'required');
         $validator = Validator::make($postData, $rules);
         if ($validator->fails()) {
             return Redirect::to('backends/quizz/add')->withInput()->withErrors($validator);
         } else {
             $question = Question::create(['topic' => $postData['topic']]);
             return Redirect::to('backends/quizz/edit/' . $question->id);
         }
     }
 }
开发者ID:imranshuvo,项目名称:QuizzApps,代码行数:26,代码来源:AdminQuizzController.php

示例13: store

 /**
  * Store a newly created resource in storage.
  * POST /questions
  *
  * @return Response
  */
 public function store()
 {
     $question = Question::create(Input::all());
     return $question;
 }
开发者ID:anildukkipatty,项目名称:fu,代码行数:11,代码来源:QuestionsController.php

示例14: array

<?php

include '../../inc/init.inc';
if ((!isset($title) || $title == "") && !isset($question_id) || (!isset($content) || $content == "")) {
    $res->load('questions', array());
} else {
    if (isset($title)) {
        $args['title'] = $title;
    }
    if (isset($question_id)) {
        $args['question_id'] = $question_id;
    }
    $args['content'] = $content;
    $args['user_id'] = $res->user->id;
    $question = Question::create($args);
    if (isset($tag_list_values)) {
        $tags = explode(',', $tag_list_values);
        foreach ($tags as $tagName) {
            $tagName = strtoupper($tagName);
            if (Tag::exists(array('name' => $tagName))) {
                $tag = Tag::find_by_name($tagName);
            } else {
                $tag = Tag::create(array('name' => $tagName));
            }
            Questions_Tag::create(array('question_id' => $question->id, 'tag_id' => $tag->id));
        }
    }
}
$res->load('question', array('id' => $question->id));
开发者ID:Osin,项目名称:Intranet,代码行数:29,代码来源:action.question.post.php

示例15: function

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    $questions = Question::orderBy('created_at', 'desc')->get();
    return View::make('index')->with('questions', $questions);
});
Route::post('/', function () {
    $body = Input::get('question');
    if (!empty($body)) {
        $answer = Answer::orderByRaw("RAND()")->get()->first();
        Question::create(array('body' => $body, 'answer' => $answer->body));
    }
    $questions = Question::orderBy('created_at', 'desc')->get();
    return View::make('index')->with('questions', $questions);
});
开发者ID:lumotroph,项目名称:TSS-cloud,代码行数:25,代码来源:routes.php


注:本文中的Question::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。