diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index 15667ed..706be79 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -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); } diff --git a/app/Models/DocumentDetail.php b/app/Models/DocumentDetail.php index e059e25..53a4bb7 100644 --- a/app/Models/DocumentDetail.php +++ b/app/Models/DocumentDetail.php @@ -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', ]; diff --git a/composer.lock b/composer.lock index 6fa51d8..7b81a8f 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/database/migrations/2023_04_17_135930_create_document_details_table.php b/database/migrations/2023_04_17_135930_create_document_details_table.php index 1f57db8..59dc081 100644 --- a/database/migrations/2023_04_17_135930_create_document_details_table.php +++ b/database/migrations/2023_04_17_135930_create_document_details_table.php @@ -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(); diff --git a/database/seeders/LabelSeeder.php b/database/seeders/LabelSeeder.php index c4a5a3c..ee2cc41 100644 --- a/database/seeders/LabelSeeder.php +++ b/database/seeders/LabelSeeder.php @@ -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', + ]); } } diff --git a/public/uploads/Transaction Report.pdf b/public/uploads/Transaction Report.pdf new file mode 100644 index 0000000..c7e61fc Binary files /dev/null and b/public/uploads/Transaction Report.pdf differ diff --git a/resources/views/pages/app/document/_form.blade.php b/resources/views/pages/app/document/_form.blade.php index 89e4781..4a4d97c 100644 --- a/resources/views/pages/app/document/_form.blade.php +++ b/resources/views/pages/app/document/_form.blade.php @@ -2,7 +2,7 @@ $route = explode('.', Route::currentRouteName()); @endphp -
+ @csrf
@@ -349,6 +349,20 @@
+ +
+ +
+ + + + +
+ +