public function show($id) { $analyse = Analyse::find($id); if (!$analyse) { return $this->respondNotFound('Analyse does not exist'); } return $this->setStatusCode(200)->respond(["analyse" => $this->analyseTransformer->transform($analyse)]); }
public function store() { $input = Input::all(); $input = $input['group']; $validator = Validator::make($input, ['name' => 'required', 'description' => 'required', 'sport_id' => 'required']); if ($validator->fails()) { return $this->respondNotFound($validator->errors()); } $group = new Group(); $group->name = $input['name']; $group->description = $input['description']; $group->sport_id = $input['sport_id']; $group->save(); return $this->setStatusCode(200)->respond(["group" => $this->groupTransformer->transform($group), "message" => "succesfully created the group"]); }
public function store() { $input = Input::all(); $input = $input['video']; $validator = Validator::make($input, ['title' => 'required', 'description' => 'required', 'url' => 'required']); if ($validator->fails()) { return $this->respondNotFound($validator->errors()); } $video = new Video(); $video->title = $input['title']; $video->description = $input['description']; $video->url = $input['url']; // $video->image_url = $input['imageUrl']; $video->save(); return $this->setStatusCode(200)->respond(["video" => $this->videoTransformer->transform($video), "message" => "succesfully created the video"]); }
public function store() { $input = Input::all(); $input = $input['user']; $validator = Validator::make($input, ['name' => 'required', 'emailaddress' => 'required', 'password' => 'required']); if ($validator->fails()) { return $this->respondNotFound($validator->errors()); } if (User::where('email', '=', Input::get('emailaddress'))->exists()) { return $this->respondNotFound("emailaddress allready in use, choose another email"); } $user = new User(); $user->name = $input['name']; $user->email = $input['emailaddress']; $user->password = Hash::make($input['password']); $user->save(); return $this->setStatusCode(200)->respond(["user" => $this->userTransformer->transform($user), "message" => "succesfully created the user account, feel free to login trough http://mytrainr.nl"]); }