Laravel get data from database by id.

2019-09-17 16:26:24 Ayush Kumar Laravel

How to get a record in Laravel by id?

Use laravel Eloquent find() method toi get a record by id in Laravel below is sample usage:

YourModal::find($id);

You can also use first method with where to get record in laravel by id.

YourModal::where('id',"=", $id)->first()

This post is submitted by one of our members. You may submit a new post here.

Related Tricks