Helpers
List of functions that works for Laravel Eloquent models.
This is the list of functions that you can import and use on your Laravel app through the static methods of the OpenSoutheners\ExtendedLaravel\Helpers class.
modelFrom
Gets model fully qualified class or instanced object from given string.
Helpers::modelFrom('post');
// 'App\Models\Post'
Helpers::modelFrom('post', false);
// object instance for App\Models\Post
Helpers::modelFrom('post', true, 'Domain\Posts');
// 'Domain\Posts\Post'isModel
Checks if object or class is a Eloquent model.
Helpers::isModel(App\Models\Post::class);
// true
Helpers::isModel(new App\Models\Post());
// trueinstanceFrom
Creates a model instance from given key (generally its ID or specified primary key).
keyFrom
Tries to get Eloquent model key from given variable (can be of multiple types).
queryFrom
Gets always a new Eloquent query builder instance from given model.
getCacheLockOwner
Get cache atomic locks owner or false otherwise if no lock found.
Last updated