feat: partner id nullable
This commit is contained in:
parent
aeebaf64a4
commit
d140e38920
|
|
@ -31,7 +31,7 @@ class HuntsController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'partner_id' => 'required|string',
|
||||
'partner_id' => 'nullable|string',
|
||||
'title' => 'required|string',
|
||||
'slug' => 'required|string|unique:hunts,slug',
|
||||
'description' => 'nullable|string',
|
||||
|
|
@ -45,9 +45,10 @@ class HuntsController extends Controller
|
|||
'start_at' => 'nullable|date',
|
||||
'end_at' => 'nullable|date',
|
||||
'image' => 'nullable|string',
|
||||
'creator_id' => 'nullable|exists:users,id',
|
||||
]);
|
||||
|
||||
$validated['creator_id'] = auth()->id();
|
||||
|
||||
$hunt = Hunts::create($validated);
|
||||
|
||||
return response()->json($hunt, 201);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('hunts', function (Blueprint $table) {
|
||||
$table->string('partner_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('hunts', function (Blueprint $table) {
|
||||
$table->string('partner_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue