コード例 #1
0
 public function validates()
 {
     if (!$this->input instanceof InputFile) {
         return true;
     }
     return in_array(File::getExtension($this->input->getName()), $this->extensions);
 }
コード例 #2
0
ファイル: ImageHandler.php プロジェクト: Monori/imgback
 public function setFilename($filename)
 {
     $this->filename = $filename;
     $this->format = File::getExtension($filename);
 }
コード例 #3
0
ファイル: Invoices.php プロジェクト: Monori/imgservice
 protected function update()
 {
     $this->post->invoice_id->addValidation(new ValidateInputNotNullOrEmpty());
     $this->post->due_date->addValidation([new ValidateInputNotNullOrEmpty(), new ValidateInputDate()]);
     $this->post->amount->addValidation([new ValidateInputNotNullOrEmpty(), new ValidateInputFloat()]);
     if (!$this->hasErrors()) {
         $this->invoice->invoice_id = $this->input('invoice_id');
         $this->invoice->due_date = Date::toDate(strtotime($this->input('due_date')));
         $this->invoice->amount_total = $this->input('amount');
         $this->invoice->payed = $this->input('payed');
         if ($this->file->invoice instanceof InputFile) {
             // Delete old invoice
             $tmp = explode('?', basename($this->invoice->path));
             $this->deleteS3($tmp[0]);
             $path = $this->uploadS3($this->file->invoice->tmpname, $this->input('invoice_id') . '.' . File::getExtension($this->invoice->invoide_id));
             $this->invoice->path = $path;
         }
         $this->invoice->update();
         $this->setMessage(lang('Invoice has been updated'), 'success');
         response()->refresh();
     }
 }