/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\QuestionRequest $request)
 {
     $Question = new \App\Question();
     $Question->question = $request->get('question');
     $Question->user_id = \Auth::user()->id;
     $Question->save();
     \Session::flash('flash_message', 'Your post has been saved !!!');
     return redirect('home');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|max:255', 'content' => 'required']);
     $q = new \App\Question();
     $q->fill($request->all());
     $q->user_id = Auth::user()->id;
     if ($q->save()) {
         Session::flash('message', "Question submitted successfully :) ");
     }
     return redirect('ask');
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $filename = $this->argument('fileName');
     $surveyJSON = file_get_contents($filename);
     $parser = new \App\Twilio\SurveyParser($surveyJSON);
     $survey = new \App\Survey();
     $survey->title = $parser->title();
     $survey->save();
     $parser->questions()->each(function ($question) use($survey) {
         $questionToSave = new \App\Question($question);
         $questionToSave->survey()->associate($survey);
         $questionToSave->save();
     });
 }
Beispiel #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $questions = App\Question::all();
     factory(App\Answer::class, 400)->make()->each(function ($answer) use($questions) {
         $question = $questions->random();
         $answer->question()->associate($question);
         $answer->user()->associate($question->course->users->random());
         $answer->save();
     });
 }
Beispiel #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     App\Quiz::create(['user_id' => 1, 'name' => 'The awesome quiz', 'desc' => 'Get ready to embark on the best quiz, OF YOUR LIFE!']);
     App\Question::create(['quiz_id' => 1, 'question_type_id' => 1, 'title' => 'Who wrote this wonderful Quiz?', 'time_limit' => 10000]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Shane', 'value' => 1, 'correct' => true]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Bob', 'value' => 1, 'correct' => false]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Jordan', 'value' => 1, 'correct' => true]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Uncle Sam', 'value' => 1, 'correct' => false]);
     Model::reguard();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('questions', function (Blueprint $table) {
         $table->increments('id');
         $table->string('question');
         $table->integer('likes');
         $table->timestamps();
     });
     Schema::table('questions', function (Blueprint $table) {
         $table->integer('job_id')->unsigned()->index();
         $table->integer('state_id')->unsigned()->index();
         $table->integer('user_id')->unsigned()->index();
     });
     App\Question::create(['question' => 'Je suis un homme ?', 'likes' => 5, 'job_id' => 1, 'user_id' => 1, 'state_id' => 1]);
 }
 public function run()
 {
     DB::table('questions')->truncate();
     // id: 1
     App\Question::create(['description' => '2 x 2 = ?', 'topic_id' => 1]);
     // id: 2
     App\Question::create(['description' => 'Who is the founder of Facebook?', 'topic_id' => 3]);
     // id: 3
     App\Question::create(['description' => '3 x 3 = ?', 'topic_id' => 1]);
     // id: 4
     App\Question::create(['description' => '4 x 6 = ?', 'topic_id' => 1]);
     // id: 5
     App\Question::create(['description' => 'Who is NOT a Beatles team member?', 'topic_id' => 2]);
     // id: 6
     App\Question::create(['description' => 'Specify the song that was created by Nirvana?', 'topic_id' => 2]);
     // id: 7
     App\Question::create(['description' => 'Who is the founder of Groupon?', 'topic_id' => 3]);
 }
Beispiel #8
0
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web', 'fw-block-bl']], function () {
    /**
     * Landing Page
     */
    Route::get('/', ['as' => 'welcome', function () {
        $news = App\News::whereType(0)->latest()->first();
        $event = App\Event::latest()->first();
        $codewars = App\CodeWarQuestion::latest()->limit(3)->get();
        $questions = App\Question::wherePublic(1)->approved()->latest()->limit(3)->get();
        $aluminis = App\Alumini::where('speech', '!=', 'null')->get()->random(2);
        $users = App\User::whereBanned(0)->latest()->limit(3)->get();
        $picture = App\Photo::whereGallery(1)->get()->random();
        $technews = App\News::whereType(1)->latest()->first();
        $qotd = App\Quote::getQotd();
        $shouts = App\Shout::limit(15)->latest()->get();
        $shouts = $shouts->sortBy('created_at');
        $urls = ['http://numbersapi.com/random/', 'http://numbersapi.com/random/year/', 'http://numbersapi.com/random/date'];
        try {
            $didyouknow = file_get_contents($urls[array_rand($urls)]);
        } catch (Exception $e) {
            $didyouknow = "This website is hosted on a VPS with 1GB of RAM and is developed using PHP as backend, MySQL & Redis for database storage, and Sockets for real time events.";
        }
        $data = ['news' => $news, 'event' => $event, 'aluminis' => $aluminis, 'codewars' => $codewars, 'questions' => $questions, 'users' => $users, 'picture' => $picture, 'technews' => $technews, 'qotd' => $qotd, 'shouts' => $shouts, 'didyouknow' => $didyouknow];
        return view('welcome', $data);
Beispiel #9
0
 /**
  * handling newly posted question.
  *
  * @return Response
  */
 public function postQuestion(Request $request)
 {
     $validate = Validator::make($request->all(), ['content' => 'required|max:200', 'from' => 'required', 'to' => 'required']);
     if ($validate->passes()) {
         $createQuestion = new \App\Question();
         $createQuestion->content = $request->input('content');
         $createQuestion->to = $request->input('to');
         $createQuestion->from = $request->input('from');
         $createQuestion->status = "pending";
         $createQuestion->votes = 1;
         $createQuestion->save();
         return redirect()->back();
     } else {
         return redirect()->back();
     }
     return redirect()->back();
 }
    $firs_name = $faker->firstName;
    $last_name = $faker->lastName;
    return ['identification' => $faker->unique()->numberBetween(5000000, 39999999), 'first_name' => $firs_name, 'last_name' => $last_name, 'avatar' => 'vendor/AdminTheme/images/avatar/default.png', 'type' => $faker->randomElement(['teacher', 'student']), 'email' => $faker->unique()->email, 'password' => '123456'];
});
$factory->define(App\Course::class, function ($faker) {
    return ['title' => $faker->sentence(3), 'description' => $faker->paragraph(10), 'image' => $faker->imageUrl(660, 260), 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Unit::class, function ($faker) {
    return ['pos' => $faker->randomNumber(1), 'title' => $faker->sentence(5), 'description' => $faker->paragraph(10), 'image' => $faker->imageUrl(660, 260), 'user_id' => App\User::all()->random()->id, 'course_id' => App\Course::all()->random()->id];
});
$factory->define(App\Lesson::class, function ($faker) {
    return ['pos' => $faker->randomNumber(1), 'title' => $faker->sentence(5), 'content' => $faker->paragraph(10), 'user_id' => App\User::all()->random()->id, 'unit_id' => App\Unit::all()->random()->id];
});
$factory->define(App\Question::class, function ($faker) {
    return ['title' => $faker->sentence(2) . '?', 'unit_id' => App\Unit::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Answer::class, function ($faker) {
    return ['content' => $faker->sentence(5), 'correct' => rand(0, 1), 'question_id' => App\Question::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Comment::class, function ($faker) {
    return ['content' => $faker->paragraph(5), 'user_id' => App\User::all()->random()->id, 'lesson_id' => App\Lesson::all()->random()->id];
});
$factory->define(App\Reply::class, function ($faker) {
    return ['content' => $faker->paragraph(5), 'user_id' => App\User::all()->random()->id, 'comment_id' => App\Comment::all()->random()->id];
});
$factory->define(App\Evaluation::class, function ($faker) {
    return ['value' => $faker->numberBetween(15, 20), 'min_value' => $faker->numberBetween(50, 85), 'max_question' => $faker->numberBetween(5, 6), 'unit_id' => App\Unit::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\CourseUser::class, function ($faker) {
    return ['course_id' => App\Course::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
Beispiel #11
0
									</td>
								</tr>
							</table>
							
							
						</div>
					</div>
					<table width="100%">
						<tr>
							<td width="10%">
								
							</td>
							<td width="90%">
								
								<?php 
$subQs = App\Question::where('subId', $question->id)->orderBy('id')->get();
?>
								@if(count($subQs) != 0)
									@foreach($subQs as $key => $subQ)
									<div class="q-box-2">
										<div style="color: #969696; font-size: 0.9em;">ความเห็นที่ {{$postNo+1}}-{{$key+1}}</div>
										<br>
										{!!$subQ->detail!!}
										<br>
										<br>
										<div class="q-box-bottom">
											<?php 
$memberCh = App\User::where('id', $subQ->memberId)->first();
$dateCreate = strtotime($subQ->created_at);
$date = date('j/n/Y', $dateCreate);
$time = date('H:i', $dateCreate);