Fix Reductions BO + Add migration Jobs table

This commit is contained in:
Romain Bonhomme 2021-02-19 12:21:56 +01:00
parent 31d0c12358
commit 6c8873e9e3
5 changed files with 40 additions and 4 deletions

View file

@ -12,7 +12,7 @@ use LDCWeb\MesBR;
class ReductionsController extends Controller
{
public function index() {
$r = Reductions::all();
$r = Reductions::where('end_date_broadcast', '>', Carbon::now())->get();
$ranges = Ranges::with('products')->get();
return view('bo.reductions.index', compact('r', 'ranges'));
}

View file

@ -94,6 +94,6 @@ class Products extends Model
public function reductions()
{
return $this->belongsToMany(Reductions::class, 'reduction_config');
return $this->belongsToMany(Reductions::class, 'reduction_config', 'product_id', 'reduction_id');
}
}

View file

@ -8,7 +8,7 @@ class Reductions extends Model
{
public function products()
{
return $this->belongsToMany(Products::class, 'reduction_config');
return $this->belongsToMany(Products::class, 'reduction_config', 'reduction_id', 'product_id');
}
public function ranges()

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

View file

@ -4,7 +4,7 @@
<div class="section-header">
<a href="{{ route('home') }}">
<picture>
<img alt="Logo - Le Gaulois" src="{{ asset('images/logo-lgl-3f.svg') }}">
<img alt="Logo - Le Gaulois" src="{{ asset('assets/images/logo-lgl-3f.svg') }}">
</picture>
</a>
</div>