Пример #1
0
 public function store(Request $request)
 {
     $file = new File();
     $file->fill($request->only('type', 'file'));
     $file->registration_id = daress_registerd()->id;
     $file->save();
     $file->isImage = substr($file->file->contentType(), 0, 5) == 'image';
     $file->file_url = asset($file->file->url());
     return $file;
 }
Пример #2
0
 public function store(CreateFileRequest $request)
 {
     if (!$this->registration->step->edit_form) {
         return redirect()->route('registration.registrar.index');
     }
     $file = new File();
     $file->fill($request->only('type', 'file'));
     $file->registration_id = $this->registration->id;
     $file->save();
     $file->isImage = substr($file->file->contentType(), 0, 5) == 'image';
     $file->file_url = asset($file->file->url());
     return $file;
 }
Пример #3
0
 public function registrarPostUpload(Request $request)
 {
     $registrar = Auth::guard('api_registration')->user();
     $file = new RegistrationFile();
     $file->fill($request->only('type', 'file'));
     $file->registration_id = $registrar->id;
     if ($file->save()) {
         $step = RegistrationStep::find($registrar->registration_step_id)->children()->where('files_processing', 1)->first();
         if ($step) {
             $registrar->registration_step_id = $step->id;
             $registrar->save();
             event(new RegistrationUpdated($registrar));
             event(new RegistrationStepChanged($registrar, ['comment' => 'قام برفع ملف']));
         }
     }
     $attachments = $file->urlsForAttachment('file');
     foreach ($attachments as $key => $attachment) {
         $attachments[$key] = asset($attachment);
     }
     $file->attachments = $attachments;
     return response()->json($file, 200, [], JSON_NUMERIC_CHECK);
 }