vendredi 23 septembre 2016

Laravel: sending parameter id type int returns null, String works fine

I am facing a strange behaviour of Laravel when I am sending request with parameter of id. If I user integer as type of the parameter the request returns null. If the parameter type is String, it returns result as expected. How can this behavour be explained? Should I always use String typed parameters? Here is my code:

    $client_id =  $request->get('client_id');
    $client = Auth::user()->**clients**->where('id', $client_id);

    if($client->isEmpty()) {
        return response(['not your client', 433]);
    }

this is how clients look:

$this->belongsToMany('App\User', 'waiter_client', 'waiter_id', 'client_id');

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire