Document item table quantity column length changes..

This commit is contained in:
Cüneyt Şentürk 2022-08-29 17:17:38 +03:00
parent 568bf86695
commit 9f172b9c0b
3 changed files with 40 additions and 4 deletions

View File

@ -69,10 +69,10 @@ class Document extends FormRequest
if ($items) {
foreach ($items as $key => $item) {
$size = 5;
$size = 10;
if (Str::contains($item['quantity'], ['.', ','])) {
$size = 7;
$size = 12;
}
$rules['items.' . $key . '.quantity'] = 'required|max:' . $size;

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Str;
class DocumentItem extends FormRequest
{
protected $quantity_size = 5;
protected $quantity_size = 10;
/**
* Get the validation rules that apply to the request.
@ -17,7 +17,7 @@ class DocumentItem extends FormRequest
public function rules()
{
if (Str::contains($this->request->get('quantity'), ['.', ','])) {
$this->quantity_size = 7;
$this->quantity_size = 12;
}
return [

View File

@ -0,0 +1,36 @@
<?php
use Doctrine\DBAL\Types\FloatType;
use Doctrine\DBAL\Types\Type;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (! Type::hasType('double')) {
Type::addType('double', FloatType::class);
}
Schema::table('document_items', function(Blueprint $table) {
$table->double('quantity', 12, 2)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};