cleanup
parent
6c9ca89c3c
commit
3fd32b23e5
|
|
@ -12,8 +12,12 @@ class DocumentController extends Controller
|
|||
{
|
||||
public function show(Document $document)
|
||||
{
|
||||
header('Content-Disposition: filename="' . $document->name . '"');
|
||||
return response()->file($document->path);
|
||||
if (file_exists($document->path)) {
|
||||
header('Content-Disposition: filename="' . $document->name . '"');
|
||||
return response()->file($document->path);
|
||||
}
|
||||
|
||||
abort(404);
|
||||
}
|
||||
|
||||
public function store(Request $request, Contract $contract)
|
||||
|
|
@ -24,7 +28,7 @@ class DocumentController extends Controller
|
|||
'name' => $file->getClientOriginalName(),
|
||||
'internal_name' => $internalName,
|
||||
'size' => $file->getSize(),
|
||||
'extension' => $file->extension(),
|
||||
'extension' => $file->extension() ?? '',
|
||||
'contract_id' => $contract->id,
|
||||
]);
|
||||
$file->move(public_path("documents/contracts/{$contract->id}/"), $internalName);
|
||||
|
|
|
|||
|
|
@ -30,10 +30,15 @@ class Document extends Model
|
|||
|
||||
public function getSizeAttribute($size)
|
||||
{
|
||||
if ($size / 1024 / 1024 < 1) {
|
||||
return (string)floor($size / 1024) . " KB";
|
||||
if ($size / 1024 < 1) {
|
||||
return $size . " B";
|
||||
}
|
||||
return (string)floor($size / 1024 / 1024) . " MB";
|
||||
|
||||
if ($size / 1024 / 1024 < 1) {
|
||||
return floor($size / 1024) . " KB";
|
||||
}
|
||||
|
||||
return floor($size / 1024 / 1024) . " MB";
|
||||
}
|
||||
|
||||
public function getLinkAttribute()
|
||||
|
|
|
|||
|
|
@ -23120,7 +23120,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
|
||||
|
||||
var _hoisted_1 = {
|
||||
"class": "grid grid-cols-12 gap-12 w-full mb-10"
|
||||
"class": "grid grid-cols-12 gap-12 w-full mb-8"
|
||||
};
|
||||
var _hoisted_2 = {
|
||||
"class": "col-span-6 xs:col-span-12"
|
||||
|
|
@ -29436,12 +29436,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
, ["document"]);
|
||||
}), 128
|
||||
/* KEYED_FRAGMENT */
|
||||
)), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_document_upload, {
|
||||
)), !$props.contract.deleted_at ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_document_upload, {
|
||||
key: 0,
|
||||
contract: $props.contract,
|
||||
documents: $data.documents
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["contract", "documents"])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_14, [_hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_car_card, {
|
||||
, ["contract", "documents"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_14, [_hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_car_card, {
|
||||
car: $props.contract.car
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<template #header>
|
||||
<slot name="header"></slot>
|
||||
</template>
|
||||
<div class="grid grid-cols-12 gap-12 w-full mb-10">
|
||||
<div class="grid grid-cols-12 gap-12 w-full mb-8">
|
||||
<div class="col-span-6 xs:col-span-12">
|
||||
<slot name="info"></slot>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
<template v-for="document in documents" :key="document.id">
|
||||
<document-item :document="document" />
|
||||
</template>
|
||||
<document-upload :contract="contract" :documents="documents" />
|
||||
<document-upload v-if="!contract.deleted_at" :contract="contract" :documents="documents" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-6 xs:col-span-12">
|
||||
|
|
|
|||
Loading…
Reference in New Issue