Retrieve all database records contributed by an individual
P粉716228245
P粉716228245 2023-09-08 16:10:51
0
1
510

How to get all the rows in the database table inserted by the logged in person? I will provide the code and snippet below

Controller.php file

public function index(){ $data['user1'] = UserModel::where('seq_id','=',Session::get('loginId'))->first(); return view ("enrollment-steps.step2", $data, [ 'data'=>$data['user1'], ]); }

Blade.php file

 

What other methods can I use to get all data inserted by the same person? The first() method will only get the last inserted row, the get() method will throwProperty [honors] does not exit on this collection instance.. For example, in the snippet below app_id 2708 has 3 rows inserted, how do I get all the data in the database connected to that person?

P粉716228245
P粉716228245

reply all (1)
P粉914731066

Controller

public function index() { $userData = UserModel::where('app_id', 2708)->get(); return view('enrollment', compact('userData')); }

blade

@foreach($userData as $data) {{$data->schoolname}} @endforeach
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!