mein-sterntours/app/Repositories/CustomerFewoFileRepository.php
2023-07-03 10:10:09 +02:00

59 lines
No EOL
1.5 KiB
PHP

<?php
namespace App\Repositories;
use App\Models\CustomerFewoFile;
use Response;
class CustomerFewoFileRepository extends FileRepository {
protected $customer_file;
protected $travel_user_id;
protected $customer_fewo_mail_id;
protected $identifier;
public function __construct(CustomerFewoFile $model){
parent::__construct();
$this->model = $model;
}
public function save(){
$this->customer_file = CustomerFewoFile::create([
'travel_user_id' => $this->travel_user_id,
'customer_fewo_mail_id' => $this->customer_fewo_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);
}
public function returnFile(){
return $this->customer_file;
}
}