Assume I have the following eloquent queries:
$collection_one = User::all();
$collection_two = Post::all();
When there are users in the collection, I can do the following in order to get the class name of the models in the collection:
$class_name = class_basename($collection_one->first());
However, I cannot figure out how to get the class name for Post, say, when there are no posts in the system.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire