chore: TV > add col company name, address, street address

v2.0.0
ricky rx 1 year ago
parent d50cde1189
commit eee7c263ab

@ -134,6 +134,9 @@ class NewTvRequest extends Model {
$tvRequest->validate([ $tvRequest->validate([
'code' => 'required|string|unique:App\Models\Tv,code', 'code' => 'required|string|unique:App\Models\Tv,code',
'company_name' => 'nullable|string',
'address' => 'nullable|string',
'street_address' => 'nullable|string',
'col1' => 'nullable|string', 'col1' => 'nullable|string',
'col2' => 'nullable|string', 'col2' => 'nullable|string',
'col3' => 'nullable|string', 'col3' => 'nullable|string',
@ -155,6 +158,9 @@ class NewTvRequest extends Model {
DB::beginTransaction(); DB::beginTransaction();
$tv = new Tv(); $tv = new Tv();
$tv->code = $tvRequest->code; $tv->code = $tvRequest->code;
$tv->company_name = $tvRequest->company_name;
$tv->address = $tvRequest->address;
$tv->street_address = $tvRequest->street_address;
$tv->col1 = $tvRequest->col1; $tv->col1 = $tvRequest->col1;
$tv->col2 = $tvRequest->col2; $tv->col2 = $tvRequest->col2;
$tv->col3 = $tvRequest->col3; $tv->col3 = $tvRequest->col3;

@ -53,6 +53,9 @@ class Tv extends Model {
->when($request->id, function($q, $id) { ->when($request->id, function($q, $id) {
$q->whereNot('id', $id); $q->whereNot('id', $id);
})], })],
'company_name' => 'nullable|string',
'address' => 'nullable|string',
'street_address' => 'nullable|string',
'col1' => 'nullable|string', 'col1' => 'nullable|string',
'col2' => 'nullable|string', 'col2' => 'nullable|string',
'col3' => 'nullable|string', 'col3' => 'nullable|string',
@ -69,6 +72,9 @@ class Tv extends Model {
try { try {
DB::beginTransaction(); DB::beginTransaction();
$tv = TV::findOrFail($request->id); $tv = TV::findOrFail($request->id);
$tv->company_name = $request->company_name;
$tv->address = $request->address;
$tv->street_address = $request->street_address;
$tv->code = $request->code; $tv->code = $request->code;
$tv->col1 = $request->col1; $tv->col1 = $request->col1;
$tv->col2 = $request->col2; $tv->col2 = $request->col2;

@ -15,7 +15,10 @@ return new class extends Migration {
$table->string('code', 50)->unique(); $table->string('code', 50)->unique();
$table->string('ik_address_id', 255)->nullable(); $table->string('ik_address_id', 255)->nullable();
$table->integer('version_code')->nullable(); $table->integer('version_code')->nullable();
$table->integer('version_name')->nullable(); $table->string('version_name')->nullable();
$table->string('company_name')->nullable();
$table->string('address')->nullable();
$table->string('street_address')->nullable();
$table->string('col1', 255)->nullable(); $table->string('col1', 255)->nullable();
$table->string('col2', 255)->nullable(); $table->string('col2', 255)->nullable();
$table->string('col3', 255)->nullable(); $table->string('col3', 255)->nullable();

Loading…
Cancel
Save