skip to Main Content

Retrieve single record in eloquent Laravel

Help me little please. I can't filtering single record. May be or not. // In Controller public function show(Post $post) { $post = Post::with(['comments' => function($query) { $query->where('status', 'active'); } ])->find($post); // can't filter comments return view('post.show', ['post' => $post]);…

VIEW QUESTION

How to apply multiple where condition on laravel eloquent having mutliple models

I have a model with four relations like as below public function custform_formfields() { return $this->hasOne(FormFieldMapping::class,'field_id','field_id'); } public function custform_fieldtype() { return $this->hasOne(FieldType::class, 'fieldtype_id', 'html_field_type'); } public function custform_forms() { return $this->hasOne(CustomForms::class,'form_id', 'form_id'); } public function custform_options() { return $this->hasOne(FormOptions::class,'option_id',…

VIEW QUESTION
Back To Top
Search