Upload Files Booking, Mails, Attachments,
This commit is contained in:
parent
5daea268f7
commit
68b9d1ff88
92 changed files with 2837 additions and 1778 deletions
53
app/Repositories/CMSFileRepository.php
Normal file
53
app/Repositories/CMSFileRepository.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\CMSContent;
|
||||
use Response;
|
||||
|
||||
class CMSFileRepository extends FileRepository {
|
||||
|
||||
protected $identifier;
|
||||
|
||||
|
||||
public function __construct($model){
|
||||
parent::__construct();
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function save(){
|
||||
$file_data = [
|
||||
'identifier' => $this->identifier,
|
||||
'filename' => $this->allowed_filename,
|
||||
'dir' => $this->dir,
|
||||
'original_name' => $this->originalName,
|
||||
'ext' => $this->extension,
|
||||
'mine' => $this->mine,
|
||||
'size' => $this->size
|
||||
];
|
||||
$data = [
|
||||
"name" => $this->originalName,
|
||||
"field" => "file",
|
||||
"full_text" => \GuzzleHttp\json_encode($file_data),
|
||||
];
|
||||
$this->model = CMSContent::create($data);
|
||||
//store in cms old Datebase
|
||||
\App\Models\Sym\CmsContent::create($data);
|
||||
}
|
||||
|
||||
|
||||
public function response(){
|
||||
return Response::json([
|
||||
'error' => false,
|
||||
'filename' => $this->allowed_filename,
|
||||
'file_id' => $this->model->id,
|
||||
'file_data' => $this->extension,
|
||||
'file_icon' => $this->model->getIconExt(),
|
||||
'file_format_bytes' => $this->model->formatBytes(),
|
||||
'file_url' => $this->model->getURL(),
|
||||
'redirect' => '',
|
||||
'code' => 200
|
||||
], 200);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue