mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
Merge branch 'helper-get-custom-field-bySlug' into 'master'
Helper for custom field to get by slug See merge request mohit.panjvani/crater-web!707
This commit is contained in:
@ -42,4 +42,11 @@ trait HasCustomFieldsTrait
|
||||
$customFieldValue->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function getCustomFieldBySlug($slug)
|
||||
{
|
||||
return $this->fields()->with('customField')->whereHas('customField', function ($query) use ($slug) {
|
||||
$query->where('slug', $slug);
|
||||
})->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user