/**
  * Store a newly created resource in storage.
  *
  * @param    \Illuminate\Http\Request  $request
  * @return  \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $test = new Test();
     $test->depoismi = $request->depoismi;
     $test->save();
     $pusher = App::make('pusher');
     //default pusher notification.
     //by default channel=test-channel,event=test-event
     //Here is a pusher notification example when you create a new resource in storage.
     //you can modify anything you want or use it wherever.
     $pusher->trigger('test-channel', 'test-event', ['message' => 'A new test has been created !!']);
     return redirect('test');
 }
Exemple #2
0
 public function store(Request $request)
 {
     if (Request::ajax()) {
         $title = $request->input('title');
         $test = new Test();
         $test->title = $title;
         $test->save();
         $return_array[] = array('response' => 'success');
         //return Redirect::back();
         return Response::json($return_array);
     } else {
         return redirect()->back()->with('status', 'Not Ajax');
     }
     //end function
 }
 public function postcreate()
 {
     $test = new Test();
     $test->id = Uuid::generate();
     $test->name = Input::get('name');
     $test->description = Input::get('description');
     $test->duration = Input::get('duration');
     $test->testday = Input::get('testday');
     $test->testtime = Input::get('testtime');
     $test->createdby = \Auth::user()->id;
     $v = \Validator::make(Input::all(), ['name' => 'required|unique:tests', 'description' => 'required', 'duration' => 'required|min:1|max:4']);
     if ($v->fails()) {
         return back()->withInput()->withErrors($v);
     } else {
         $test->save();
         foreach ((array) Input::get('ratings') as $key => $rating) {
             $testRating = new TestRating();
             $testRating->id = $test->id;
             $testRating->rating = intval($rating);
             $testRating->save();
         }
     }
     return redirect("/admin/test");
 }
 /**
  * Evaluate the points of a single question
  *
  * @param Question $question
  * @param Test $test
  */
 private function evaluate(Question $question, Test $test)
 {
     if ($question->correct1 + $question->correct2 + $question->correct3 + $question->correct4 + $question->correct5 == 0) {
         abort(404);
     }
     if ($question->correct1 == 1) {
         $test->points++;
     }
     if ($question->correct2 == 1) {
         $test->points++;
     }
     if ($question->correct3 == 1) {
         $test->points++;
     }
     if ($question->correct4 == 1) {
         $test->points++;
     }
     if ($question->correct5 == 1) {
         $test->points++;
     }
     $test->save();
 }
Exemple #5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $test = new Test();
     $test->content = 'test';
     $test->save();
 }
 public function receive_video_convert_notifications()
 {
     $post = file_get_contents('php://input');
     $test = new Test();
     $test->content = $post;
     $test->save();
     $noti = json_decode($post);
     $message = json_decode($noti->Message);
     $jobId = $message->jobId;
     $video_name = '/videos/' . $message->outputs[0]->key;
     $video_url = config('app.s3_url') . $video_name;
     $publish_data = array("event" => "transcode-video", "data" => ["video_url" => $video_url, 'video_name' => $video_name, 'jobId' => $jobId, 'thumb_url' => $video_url]);
     Redis::publish('colorme-channel', json_encode($publish_data));
     $tmp_file_name = "/" . $message->input->key;
     $s3 = \Illuminate\Support\Facades\Storage::disk('s3');
     $s3->delete($tmp_file_name);
     return "done";
 }