mardi 27 mars 2018

Get data whereBeetween two coloms

I'm using Laravel 5.5.
I have Table centrals with Model Centrals and table like this

enter image description here

my Controller

    $from = $request->year_from;
    $to   = $request->year_to;
    $month_from = $request->month_from;
    $month_to   = $request->month_to;
    $param = $request->get('parameters_id', []);

    $search = Centrals::whereIn('parameters_id', $param)
    ->where('type', 'Monthly')
    ->where('year', $from)
    ->whereBetween('months_id', [$month_from, $month_to])
    ->orderBy('year')
    ->get();

now how i get data example request:

$request->year_from = 2016;
$request->month_from = 1; /* 1 =Jan*/
$request->year_from = 2018;
$request->month_from = 3; /* 3 =Mar*/



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire