skip to Main Content

I am getting this error while want to update in the database – Laravel

Missing required parameter for [Route: blog.update] [URI: blog/{post}/update] [Missing parameter: post]. in routes : Route::put('/blog/{post}/update', [BlogController::class, 'update'])->name('blog.update'); in BlogController : ` public function update(Request $request,Post $post){ $request->validate([ 'title' => 'required', 'image' => 'required | image', 'body' => 'required' ]); $postId…

VIEW QUESTION

laravel count relation return Call to a member function addEagerConstraints() on int

I want to get relation: Package::whereIn('id', $cart_items)->with('course')->select('id', 'name')->get(); It return successfully as object, but now I need to count this relation, I did: function courses(){ return $this->hasMany('AppModelsCourse', 'package_id','id'); } public function getCourseCount() { return $this->courses()->count(); } And then: Package::whereIn('id', $cart_items)->with('getCourseCount')->select('id',…

VIEW QUESTION
Back To Top
Search