ali_254 Posted June 4, 2021 Share Posted June 4, 2021 hi... i create model of eloquent end create table.... in file controller , i add this code but return null😪 public function index2(Request $request,$id){ $data1=Motorolla::find($request['1']); dd($data1); return view('audi')->with('id',$id)->with('data1',$data1); } file web.php: Route::get('/audi/{id}','HomeController@index2' ); table motorolla: public function up() { Schema::create('motorollas', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('address'); $table->string('password'); $table->timestamps(); }); Quote Link to comment https://forums.phpfreaks.com/topic/312852-return-null-when-connect-with-eloquent/ Share on other sites More sharing options...
requinix Posted June 4, 2021 Share Posted June 4, 2021 What is $request[1] supposed to be? Don't you mean $id? 1 Quote Link to comment https://forums.phpfreaks.com/topic/312852-return-null-when-connect-with-eloquent/#findComment-1586996 Share on other sites More sharing options...
ali_254 Posted June 4, 2021 Author Share Posted June 4, 2021 10 minutes ago, requinix said: What is $request[1] supposed to be? Don't you mean $id? thanks... i edit code . The problem was solved.. $data1=Motorolla::find(1); Quote Link to comment https://forums.phpfreaks.com/topic/312852-return-null-when-connect-with-eloquent/#findComment-1586997 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.