I have a DDBB that I'm allready consuming with STRAPI, and I get data via REST API.
I can make this request and the data is automatically filtered...
http://localhost:1337/filial-cruzas?_limit=-1&filial_id=543&activa=1
But I need to convert this to laravel, I allready get information with the base Route:
Route::get('filialcruzas', 'FilialCruzaController@index');
and of course I have this route also:
Route::get('filialcruzas/{id}', 'FilialCruzaController@show');
So I can get a list or a single record.
But I need to filter the list, in the backend, like Strapi do.
I just added Request param to index method, but is allways empty. What do I have to do to receive all the URL ? Then I figure out how to parse and use what I need ...
This is mi Controller
class FilialCruzaController extends Controller
{
//
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
//
$filialcruzas=Cache::remember('cachefc',15/60,function()
{
return FilialCruza::simplePaginate(10); // Paginamos cada 10 elementos.
});
return response()->json(['status'=>'ok',
'request' => $request,
'data'=>$filialcruzas],200);
}
...
}
Any idea will be appreciatted!! Best Regards!