Select data from database and fetch data in the laravel model page. You need fetch result in model for work next label. You can do it easily to follow this example.
First you need to declare the DB facade in the controller if you cont declared this code then copy this code and put this line in your page.
<?php use IlluminateSupportFacadesDB; ?>
Now you can select table row to using this code
<?php $getUserdata= DB::table('users')->where('email', $email)->get(); echo $getUserdata[0]->name; ?>
or try this
$getUserByEmail = DB::select('SELECT * FROM users WHERE email = ?' , ['useremailaddress@email .com']);
Hope this helps.
Question and answer is powered by AnsPress.io