public function store(Request $request)
 {
     $data['project_id'] = $request->project_id;
     $data['name'] = $request->name;
     $data['description'] = $request->description;
     $data['file'] = $request->file('file');
     $data['extension'] = $data['file']->getClientOriginalExtension();
     $this->service->createFile($data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     if (!$request->has('file')) {
         return ['error' => true, 'message' => 'Por favor, insira um arquivo'];
     }
     $file = $request->file('file');
     $extension = $file->getClientOriginalExtension();
     $data = ['file' => $file, 'extension' => $extension, 'name' => $request->name, 'description' => $request->description, 'project_id' => $request->project_id];
     return $this->service->createFile($data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $file = $request->file('file');
     //Nome do campo onde o arquivo será postado
     $extension = $file->getClientOriginalExtension();
     $data['file'] = $file;
     $data['extension'] = $extension;
     $data['name'] = $request->name;
     $this->service->createFile($data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     //dd($request->name);
     $file = $request->file('file');
     //$extension = $file->getClientOriginalExtension();
     $data = ['file' => $request->file, 'name' => $request->name, 'project_id' => $request->project_id, 'description' => $request->description];
     //dd($data);
     // ProjectService
     return $this->service->createFile($data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     try {
         $validator = Validator::make($request->all(), ['file' => 'required']);
         if ($validator->fails()) {
             return ['error' => true, 'message' => 'File missing'];
         }
         $file = $request->file('file');
         $extension = $file->getClientOriginalExtension();
         $data = ['file' => $file, 'extension' => $extension, 'name' => $request->name, 'project_id' => $request->project_id, 'description' => $request->description];
         $this->service->createFile($data);
         return ['message' => 'File stored'];
     } catch (Exception $e) {
         return ['error' => true, 'message' => 'Error'];
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['file' => 'required|max:10000|mimes:pdf']);
     if ($validator->fails()) {
         return $validator->errors()->all();
     }
     $file = $request->file('file');
     $extension = $file->getClientOriginalExtension();
     $name = $file->getClientOriginalName();
     $data['file'] = $file;
     $data['extension'] = $extension;
     //$data['name'] = $request->name;
     $data['name'] = $name;
     $data['project_id'] = $request->project_id;
     $data['description'] = $request->description;
     $this->service->createFile($data);
 }
 public function store(Request $request)
 {
     $rules = array('file' => 'required');
     $file = $request->file('file');
     $validator = Validator::make(array('file' => $file), $rules);
     if ($validator->fails()) {
         return response()->json(['error' => true, 'message' => "Arquivo não selecionado"]);
     } elseif ($validator->passes()) {
         $extension = $file->getClientOriginalExtension();
         $data['file'] = $file;
         $data['extension'] = $extension;
         $data['name'] = $request->name;
         $data['project_id'] = $request->project_id;
         $data['description'] = $request->description;
         try {
             $this->validator->with($data)->passesOrFail();
             $this->service->createFile($data);
         } catch (ValidatorException $e) {
             return response()->json(['error' => true, 'message' => $e->getMessageBag()]);
         }
     }
 }
 public function store(Request $request)
 {
     $this->service->createFile($request);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, $project_id)
 {
     return $this->service->createFile($request, $project_id);
 }