mirror of https://github.com/kcal-app/kcal.git
Make recipe description and units fields optional
This commit is contained in:
parent
5513c2b37c
commit
03f9d5395a
|
@ -60,11 +60,11 @@ class RecipeController extends Controller
|
|||
{
|
||||
$input = $request->validate([
|
||||
'name' => 'required|string',
|
||||
'description' => 'required|string',
|
||||
'description' => 'nullable|string',
|
||||
'servings' => 'required|numeric',
|
||||
'foods_amount' => ['required', 'array', new ArrayNotEmpty],
|
||||
'foods_amount.*' => 'required_with:foods.*|nullable|numeric|min:0',
|
||||
'foods_unit' => ['required', 'array', new ArrayNotEmpty],
|
||||
'foods_unit' => ['required', 'array'],
|
||||
'foods_unit.*' => 'nullable|string',
|
||||
'foods' => ['required', 'array', new ArrayNotEmpty],
|
||||
'foods.*' => 'required_with:foods_amount.*|nullable|exists:App\Models\Food,id',
|
||||
|
|
|
@ -17,7 +17,7 @@ class CreateRecipesTable extends Migration
|
|||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->longText('description');
|
||||
$table->longText('description')->nullable();
|
||||
$table->unsignedInteger('servings');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MakeRecipeDescriptionOptional extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('recipes', function (Blueprint $table) {
|
||||
$table->string('description')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('recipes', function (Blueprint $table) {
|
||||
$table->string('description')->change();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -49,7 +49,8 @@
|
|||
class="block mt-1 w-full"
|
||||
type="number"
|
||||
name="servings"
|
||||
:value="old('servings')" />
|
||||
:value="old('servings')"
|
||||
required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue