Last active
August 11, 2023 10:24
-
-
Save vielhuber/260eec605196d2f9f83b86c781345a18 to your computer and use it in GitHub Desktop.
get class model name of object #laravel #php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
get_class($obj) // App\Models\Foo | |
class_basename($obj) // Foo | |
(new ReflectionClass($obj))->getShortName() // Foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment