Using 5.8 and wondering if it's possible to go from a Fully Qualified Name string i.e., App\Models\WorkflowType to the string name of the relationship, in this case workflowType to access the method on the Model without a bunch of String Fu. My relationship:
/**
* Many-to-One relationship to WorkflowType
*
* @return \Illuminate\Database\Eloquent\Relations\belongsTo
*/
public function workflowType()
{
return $this->belongsTo(WorkflowType::class, 'workflow_type_uuid', 'workflow_type_uuid');
}
Note: just wondering if there's a "laravel" way of doing this that I'm unaware of. I know that I can do this: Str::camel(str_replace('App\\Models\\', '', $className)).
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire