Document item table quantity column length changes..
This commit is contained in:
parent
568bf86695
commit
9f172b9c0b
@ -69,10 +69,10 @@ class Document extends FormRequest
|
|||||||
|
|
||||||
if ($items) {
|
if ($items) {
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
$size = 5;
|
$size = 10;
|
||||||
|
|
||||||
if (Str::contains($item['quantity'], ['.', ','])) {
|
if (Str::contains($item['quantity'], ['.', ','])) {
|
||||||
$size = 7;
|
$size = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rules['items.' . $key . '.quantity'] = 'required|max:' . $size;
|
$rules['items.' . $key . '.quantity'] = 'required|max:' . $size;
|
||||||
|
@ -7,7 +7,7 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class DocumentItem extends FormRequest
|
class DocumentItem extends FormRequest
|
||||||
{
|
{
|
||||||
protected $quantity_size = 5;
|
protected $quantity_size = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@ -17,7 +17,7 @@ class DocumentItem extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
if (Str::contains($this->request->get('quantity'), ['.', ','])) {
|
if (Str::contains($this->request->get('quantity'), ['.', ','])) {
|
||||||
$this->quantity_size = 7;
|
$this->quantity_size = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
36
database/migrations/2022_08_29_000000_core_v307.php
Normal file
36
database/migrations/2022_08_29_000000_core_v307.php
Normal 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()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user