samedi 28 avril 2018

How to get multiple result using Eloquent

I can get first result using this code

public function search(Request $request)
{
    $record = St::where('pn', $request->input)->first();
    $param = ['input' => $request->input, 'record' =>$record];
    return view('contacts.find', $param);

}

but, I changed like this

        $record = St::where('pn', $request->input)->get();

error show up

Method Illuminate\Database\Eloquent\Collection::getData does not exist

Could someone tell me why?

my version is 5.6



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire