Question and answer is powered by AnsPress.io
I am using laravel 5.2 and I want to get a single data from database in my model page. I can’t do it. How I will solve it
Try with this code hope it will be helpful for you
Model:
<?php $data=DB::table('table_name')->where('id',$session_id)->get(); echo $data[0]->name; ?>
if data is print so store data in a variable. That’s like
<?php $name=$data[0]->name; echo $name; ?>