Skip to content

Commit 3910e10

Browse files
committed
Set snackspace product max short_description lengthto 25
1 parent 7d22655 commit 3910e10

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

app/HMS/Mappings/HMS.Entities.Snackspace.Product.dcm.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ HMS\Entities\Snackspace\Product:
2222
nullable: true
2323
shortDescription:
2424
type: string
25+
length: 25
2526
longDescription:
2627
type: text
2728
nullable: true

app/Http/Controllers/Snackspace/ProductController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function create()
6969
public function store(Request $request)
7070
{
7171
$validatedData = $request->validate([
72-
'shortDescription' => 'required|string|max:255',
72+
'shortDescription' => 'required|string|max:25',
7373
'longDescription' => 'sometimes|nullable|string',
7474
'barcode' => 'sometimes|nullable|string|max:255',
7575
'price' => 'required|integer|min:1',
@@ -129,7 +129,7 @@ public function edit(Product $product)
129129
public function update(Request $request, Product $product)
130130
{
131131
$validatedData = $request->validate([
132-
'shortDescription' => 'required|string|max:255',
132+
'shortDescription' => 'required|string|max:25',
133133
'longDescription' => 'sometimes|nullable|string',
134134
'barcode' => 'sometimes|nullable|string|max255',
135135
'price' => 'required|integer|min:1',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Database\Migrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
final class Version20241120222758_alter_snackspace_short_description_max_length extends AbstractMigration
11+
{
12+
public function getDescription(): string
13+
{
14+
return '';
15+
}
16+
17+
public function up(Schema $schema): void
18+
{
19+
$this->addSql('ALTER TABLE products CHANGE short_description short_description VARCHAR(25) NOT NULL');
20+
}
21+
22+
public function down(Schema $schema): void
23+
{
24+
$this->addSql('ALTER TABLE products CHANGE short_description short_description VARCHAR(255) NOT NULL');
25+
}
26+
}

0 commit comments

Comments
 (0)