Esempio n. 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Project $project, Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     $backlog = Backlog::create($request->only('name'));
     $project->backlogs()->save($backlog);
     $user->backlogs()->save($backlog);
     return response()->json(['status' => 'success', 'backlog' => $backlog]);
 }
Esempio n. 2
0
 /**
  * Saves a backlog, to be invoked via ajax
  *
  * @param  Request $request 
  * @return JSON
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'project_id' => 'required']);
     $backlog = Backlog::create($request->all());
     $backlog->load('user');
     $backlog = $backlog->toArray();
     if (is_null($backlog['user'])) {
         $backlog['user']['name'] = '';
     }
     return $backlog;
 }