Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $proj_array = $request->get('project');
     $project = Project::create($proj_array);
     $project->members()->attach($proj_array['team']);
     $table_name = Cleaner::name($project->name) . '_' . $project->organization->id;
     $project->table_name = $table_name;
     $project->save();
     Schema::create($table_name, function (Blueprint $table) {
         $table->increments('id');
         $table->integer('respondent_id');
         $table->timestamps();
     });
     return redirect('/project/' . $project->id);
 }
Ejemplo n.º 2
0
 public function getPlanning()
 {
     try {
         $params = $this->getParams();
         if (count($params) > 3 || count($params) < 3) {
             throw new MissingParamsException();
         }
         if ($params != Cleaner::clean($params)) {
             throw new MissingParamsException();
         }
         $response = new AJAXAnswer(true);
         $response->setMessage(Planning::getPlanning($params[0], $params[1], $params[2]));
         $response->answer();
     } catch (MissingParamsException $e) {
         $error = new AJAXAnswer(false, 'Missing Parameters for this query');
         $error->answer();
     }
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     try {
         // pull question object
         $question = Question::create($request->get('question'));
         // clean the question name for db naming
         $qname = Cleaner::name($question->name);
         // pull project object
         $project = $question->topic->project;
         // add question field to project table
         Tables::createDataField($project->table_name, $question->type, $qname);
     } catch (Exception $e) {
         return $e;
     } finally {
         // return single list group line to ajax requests
         return view('includes.question', compact('question'));
     }
 }