예제 #1
0
 public function saveQuestion($PostID)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $data = Request::capture();
     $question = new Questions();
     $question->PostID = $PostID;
     $question->ThumbnailID = $data['ThumbnailID'];
     $question->Question = $data['Question'];
     $question->Description = $data['Description'];
     switch ($data['ThumbnailID']) {
         case '1':
             // Photo
             $question->save();
             $question = Questions::orderBy('id', 'desc')->first();
             //Photo
             $file = Request::capture()->file('Photo');
             if ($file != null) {
                 $question->Photo = 'Question_' . $PostID . '_' . $question->id . "_-Evangels-English-www.evangelsenglish.com_" . "." . $file->getClientOriginalExtension();
                 $file->move(base_path() . '/public/images/imageQuestion/', $question->Photo);
             }
             $question->update();
             break;
         case '2':
             // Video
             $linkVideo = $data['Video'];
             $question->Video = PostsController::getYoutubeVideoID($linkVideo);
             $question->save();
             break;
     }
     echo $question->id;
     return;
 }
예제 #2
0
 public function post_question($user_id, $cat_id, $question_content)
 {
     $question = new Questions();
     $question->user_id = $user_id;
     $question->cat_id = $cat_id;
     $question->content = $question_content;
     if ($question->save()) {
         return $question->toArray();
     }
     return FALSE;
 }
예제 #3
0
 public function contact(Request $request)
 {
     $this->validate($request, ['question' => 'required', 'email' => 'email']);
     if (!isset($request->confirmed)) {
         return View('contact.confirm', compact('request'));
     } else {
         if (isset($request->art_id)) {
             $art_id = $request->art_id;
         } else {
             $art_id = 0;
         }
         $input = new Questions();
         $input->art_id = $art_id;
         $input->question = $request->question;
         $input->question = $request->email;
         $input->user_id = Auth::user()->id;
         $input->save();
         return View('contact.contact')->withSuccess(trans('succes.asked'));
     }
 }
예제 #4
0
 public function store()
 {
     if (!Auth::check()) {
         return;
     }
     $validator = Validator::make(['name' => Input::get("name"), 'email' => Input::get("email"), 'question' => Input::get("question")], ['name' => 'required|max:255', 'email' => 'required|email|max:255', 'question' => 'required']);
     if ($validator->fails()) {
         return "Fields name, email and question are mandatory";
     }
     $data = new Questions();
     $data->title = Input::get("name");
     $data->question = Input::get("question");
     $data->status = "0001";
     $state = Classif::where('name', 'PARAGRAPH_STATE')->where('code', '0001')->first();
     $data->cid = $state->id;
     $data->email = Input::get("email");
     $data->save();
     return redirect('/questions');
     //maybe dynamic insert without refresh
 }
예제 #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $tags = str_replace(" ", "", $request["tags"]);
     $tags = mb_strtolower($tags);
     $title = mb_strtoupper($request["title"]);
     $question = new Questions();
     $question->user_id = Auth::user()->id;
     $question->title = $title;
     $question->question = $request->question;
     $question->tags = $tags;
     $question->rate = 0;
     $question->date = date("Y-m-d H:i:s");
     $question->save();
     return view('QA.create')->with("questions", $request);
 }