Schema::create('stocks', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('title');
$table->text('content');
$table->dateTime('date')->default(DB::raw('CURRENT_TIMESTAMP'));
});
foreach ($filters as $filter) {
if ($filter['operation'] === 'in') {
$builder = $builder->whereHas('resource', function ($query) use ($filter) {
$query->whereIn($filter['name'], $filter['value']);
});
} else {
$builder = $builder->whereHas('resource', function ($query) use ($filter) {
$query->where($filter['name'], $filter['value']);
});
}
}
$allImages = $request->allFiles();
$firstImage = $allImages[0];
$secondImage = $allImages[1];