/**
  * Store a newly created IwomenPost in storage.
  * POST /iwomenPosts
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (sizeof(IwomenPost::$rules) > 0) {
         $validator = $this->validateRequestOrFail($request, IwomenPost::$rules);
         if ($validator) {
             return $validator;
         }
     }
     $input = $request->all();
     $input['objectId'] = 'iPost' . str_random(10);
     $iwomenPosts = $this->iwomenPostRepository->create($input);
     return $this->sendResponse($iwomenPosts->toArray(), "IwomenPost saved successfully");
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created IwomenPost in storage.
  *
  * @param CreateIwomenPostRequest $request
  *
  * @return Response
  */
 public function store(CreateIwomenPostRequest $request)
 {
     $input = $request->all();
     $input['objectId'] = 'iPost' . str_random(10);
     if ($request->file('image')) {
         $image = $this->uploadImage($request->file('image'), '/posts_photo/');
         $input['image'] = $image['resize_url'][0];
     }
     if ($request->file('postUploadPersonImg')) {
         $image = $this->uploadImage($request->file('postUploadPersonImg'), '/posts_photo/');
         $input['postUploadPersonImg'] = $image['resize_url'][0];
     }
     if ($request->file('postUploadUserImgPath')) {
         $image = $this->uploadImage($request->file('postUploadUserImgPath'), '/posts_photo/');
         $input['postUploadUserImgPath'] = $image['resize_url'][0];
     }
     if ($request->file("audioFile")) {
         $input['audioFile'] = $this->uploadAudio($request->file('audioFile'), '/posts_audio/');
     }
     $iwomenPost = $this->iwomenPostRepository->create($input);
     Flash::success('IwomenPost saved successfully.');
     return redirect(route('iwomenPosts.index'));
 }