how to initiate lists

Posted 1 year ago by Thameera

public function myform() { $states = DB::table("demo_state")->lists("name","id"); return view('myform',compact('states')); } here i use lists to get the id when name is selected but when compile it shows

"Call to undefined method Illuminate\Database\Query\Builder::lists()" this error am i need to initiate lists in model and how to do that

Please sign in or create an account to participate in this conversation.