Update Module Document Management, add upload file

This commit is contained in:
Daeng Deni Mardaeni 2023-04-18 09:55:51 +07:00
parent 74e9edc6b6
commit 548b345111
7 changed files with 63 additions and 33 deletions

View File

@ -100,6 +100,14 @@
'group' => $request->group,
];
if($request->hasFile('file_upload')) {
$file = $request->file('file_upload');
$filename = $file->getClientOriginalName();
$file->move(public_path('uploads'), $filename);
$detail['file_name'] = $filename;
$detail['file_path'] = public_path('uploads');
}
DocumentDetail::create($detail);
}

View File

@ -32,7 +32,10 @@ class DocumentDetail extends Model
'custom_field_1',
'custom_field_2',
'custom_field_3',
'custom_field_4'
'custom_field_4',
'file_name',
'file_path',
];

59
composer.lock generated
View File

@ -691,22 +691,22 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "7.5.0",
"version": "7.5.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba"
"reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba",
"reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9",
"reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5",
"guzzlehttp/psr7": "^1.9 || ^2.4",
"guzzlehttp/psr7": "^1.9.1 || ^2.4.5",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
@ -799,7 +799,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.5.0"
"source": "https://github.com/guzzle/guzzle/tree/7.5.1"
},
"funding": [
{
@ -815,7 +815,7 @@
"type": "tidelift"
}
],
"time": "2022-08-28T15:39:27+00:00"
"time": "2023-04-17T16:30:08+00:00"
},
{
"name": "guzzlehttp/promises",
@ -903,22 +903,22 @@
},
{
"name": "guzzlehttp/psr7",
"version": "2.4.4",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf"
"reference": "b635f279edd83fc275f822a1188157ffea568ff6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6",
"reference": "b635f279edd83fc275f822a1188157ffea568ff6",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^1.1 || ^2.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
@ -938,9 +938,6 @@
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
@ -1002,7 +999,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.4.4"
"source": "https://github.com/guzzle/psr7/tree/2.5.0"
},
"funding": [
{
@ -1018,7 +1015,7 @@
"type": "tidelift"
}
],
"time": "2023-03-09T13:19:02+00:00"
"time": "2023-04-17T16:11:26+00:00"
},
{
"name": "guzzlehttp/uri-template",
@ -7881,16 +7878,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.0",
"version": "10.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "fc4f5ee614fa82d50ecf9014b51af0a9561f3df8"
"reference": "884a0da7f9f46f28b2cb69134217fd810b793974"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fc4f5ee614fa82d50ecf9014b51af0a9561f3df8",
"reference": "fc4f5ee614fa82d50ecf9014b51af0a9561f3df8",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/884a0da7f9f46f28b2cb69134217fd810b793974",
"reference": "884a0da7f9f46f28b2cb69134217fd810b793974",
"shasum": ""
},
"require": {
@ -7909,7 +7906,7 @@
"theseer/tokenizer": "^1.2.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^10.1"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
@ -7947,7 +7944,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.0"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.1"
},
"funding": [
{
@ -7955,7 +7952,7 @@
"type": "github"
}
],
"time": "2023-04-13T07:08:27+00:00"
"time": "2023-04-17T12:15:40+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -8200,16 +8197,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.1.0",
"version": "10.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "5a477aea03e61329132935689ae2d73f418f5e25"
"reference": "0d9401b7e8245d71079e249e3cb868e9d2337887"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5a477aea03e61329132935689ae2d73f418f5e25",
"reference": "5a477aea03e61329132935689ae2d73f418f5e25",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0d9401b7e8245d71079e249e3cb868e9d2337887",
"reference": "0d9401b7e8245d71079e249e3cb868e9d2337887",
"shasum": ""
},
"require": {
@ -8223,7 +8220,7 @@
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"php": ">=8.1",
"phpunit/php-code-coverage": "^10.1",
"phpunit/php-code-coverage": "^10.1.1",
"phpunit/php-file-iterator": "^4.0",
"phpunit/php-invoker": "^4.0",
"phpunit/php-text-template": "^3.0",
@ -8281,7 +8278,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.0"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.1"
},
"funding": [
{
@ -8297,7 +8294,7 @@
"type": "tidelift"
}
],
"time": "2023-04-14T05:15:09+00:00"
"time": "2023-04-17T12:17:05+00:00"
},
{
"name": "sebastian/cli-parser",

View File

@ -33,6 +33,8 @@ return new class extends Migration
$table->string('custom_field_4')->nullable();
$table->string('status')->nullable();
$table->string('keterangan')->nullable();
$table->string('file_name')->nullable();
$table->string('file_path')->nullable();
$table->timestamps();
$table->softDeletes();

View File

@ -3,6 +3,7 @@
namespace Database\Seeders;
use App\Models\Directorat;
use App\Models\DocumentType;
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
@ -64,5 +65,10 @@ class LabelSeeder extends Seeder
'kode' => '98',
'name' => 'Softcopy'
]);
$documentType = DocumentType::create([
'kode' => '01',
'name' => 'Surat Masuk',
]);
}
}

Binary file not shown.

View File

@ -2,7 +2,7 @@
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin:Form-->
<form class="form_{{$route[0]}}" method="POST" action="{{ route($route[0].'.store') }}">
<form class="form_{{$route[0]}}" enctype="multipart/form-data" method="POST" action="{{ route($route[0].'.store') }}">
@csrf
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
@ -349,6 +349,20 @@
</div>
<!--end::Input group-->
</div>
<div class="col-lg-12">
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span>File</span>
<span class="ms-1" data-bs-toggle="tooltip" title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="file" accept="application/pdf,image/*" class="form-control form-control-solid" name="file_upload" />
</div>
<!--end::Input group-->
</div>
</div>
<!--begin::Actions-->