mein-sterntours/app/Repositories/CustomerFileRepository.php
2020-04-17 15:51:22 +02:00

55 lines
No EOL
1.4 KiB
PHP

<?php
namespace App\Repositories;
use App\Models\CustomerFile;
use Response;
class CustomerFileRepository extends FileRepository {
protected $customer_file;
protected $customer_id;
protected $customer_mail_id;
protected $identifier;
public function __construct(CustomerFile $model){
parent::__construct();
$this->model = $model;
}
public function save(){
$this->customer_file = CustomerFile::create([
'customer_id' => $this->customer_id,
'customer_mail_id' => $this->customer_mail_id,
'identifier' => $this->identifier,
'filename' => $this->allowed_filename,
'dir' => $this->dir,
'original_name' => $this->originalName,
'ext' => $this->extension,
'mine' => $this->mine,
'size' => $this->size
]);
}
public function response(){
return Response::json([
'error' => false,
'original_name' => $this->originalName,
'filename' => $this->allowed_filename,
'file_id' =>$this->customer_file->id,
'file_data' => $this->extension,
'file_icon' => $this->customer_file->getIconExt(),
'file_format_bytes' => $this->customer_file->formatBytes(),
'file_url' => $this->customer_file->getURL(),
'redirect' => '',
'code' => 200
], 200);
}
}