46 lines
No EOL
1.4 KiB
PHP
46 lines
No EOL
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\TravelUserBookingFile;
|
|
use Response;
|
|
|
|
class BookingFewoFileRepository extends FileRepository {
|
|
|
|
protected $booking_fewo_file;
|
|
protected $travel_user_booking_fewo_id;
|
|
protected $identifier;
|
|
|
|
public function __construct(TravelUserBookingFile $model){
|
|
parent::__construct();
|
|
$this->model = $model;
|
|
}
|
|
|
|
public function save(){
|
|
$this->booking_fewo_file = TravelUserBookingFile::create([
|
|
'travel_user_booking_fewo_id' => $this->travel_user_booking_fewo_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,
|
|
'filename' => $this->allowed_filename,
|
|
'file_id' =>$this->booking_fewo_file->id,
|
|
'file_data' => $this->extension,
|
|
'file_icon' => $this->booking_fewo_file->getIconExt(),
|
|
'file_format_bytes' => $this->booking_fewo_file->formatBytes(),
|
|
'file_url' => $this->booking_fewo_file->getURL(),
|
|
'redirect' => '',
|
|
'code' => 200
|
|
], 200);
|
|
}
|
|
|
|
} |