This commit is contained in:
Kekskurse 2021-01-12 17:55:32 +01:00
parent fc0df020e8
commit cecfd21409
2 changed files with 3 additions and 1 deletions

View File

@ -89,6 +89,8 @@ class GalleryController extends BaseController
$gallery->tenant = session("current_tenant_id"); $gallery->tenant = session("current_tenant_id");
if(!empty($validated["date"])) { if(!empty($validated["date"])) {
$gallery->gallery_create_time = $validated["date"]; $gallery->gallery_create_time = $validated["date"];
} else {
$gallery->gallery_create_time = date("Y-m-d");
} }
$gallery->saveOrFail(); $gallery->saveOrFail();

View File

@ -20,7 +20,7 @@ class Gallery extends Migration
$table->string('url'); $table->string('url');
$table->mediumText("description")->nullable(); $table->mediumText("description")->nullable();
$table->unsignedBigInteger("tenant"); $table->unsignedBigInteger("tenant");
$table->date("gallery_create_time")->default(\Illuminate\Support\Facades\DB::raw('(CURRENT_DATE)')); $table->date("gallery_create_time")->nullable();
$table->foreign('tenant')->references('id')->on('tenants'); $table->foreign('tenant')->references('id')->on('tenants');