search database record using laravel code example
Example 1: where like laravel
User::query()
->where('name', 'LIKE', "%{$searchTerm}%")
->orWhere('email', 'LIKE', "%{$searchTerm}%")
->get();
reference:
https://freek.dev/1182-searching-models-using-a-where-like-query-in-laravel
Example 2: how to get data from a table in laravel
use Illuminate\Support\Facades\DB;
class UserController extends Controller
{
public function index()
{
$users = DB::table('users')->select('id','name','email')->get();
return view('some-view')->with('users', $users);
}
}