Models Helper
This helper will provide information about general settings used in models, like namespace, directory, etc.
Models Helper is "macroable" and "collectable", which allows you to run batch methods and collect output with ModelsHelper::collect('dir', 'path')
Dir
/**
* Get models' directory name
* @return string
*/
ModelsHelper::dir(): void
Path
/**
* Get models' directory path
* Path is set optimistically - meaning: it does not check if any files exist inside or if those files are models.
* @return string
*/
ModelsHelper::path(): void
List
/**
* Get collection of models
* @param string|null $path
* @return Collection
*/
ModelsHelper::list(): void
Classes
/**
* Get list of models' classes
* @param string|null $path
* @return Collection
*/
ModelsHelper::classes(): void
Names
/**
* Get list of models' names
* @param string|null $path
* @return Collection
*/
ModelsHelper::names(): void
Namespace
/**
* Get most commonly used namespace
* @return string
*/
ModelsHelper::namespace(): void
Files
/**
* Get list of models' files
* @param string|null $path
* @return Collection
*/
ModelsHelper::files(): void
User
/**
* Get User model as defined in auth provider
* @return string
*/
ModelsHelper::user(): void
Search
/**
* Search for model by an approximate name string. It will always return a closest model.
* @param string $name
* @return Model
*/
ModelsHelper::search(): void
Class
/**
* Build full class from name
* @param string $name
* @return string
*/
ModelsHelper::class(): void
Table
/**
* Get table from name
* @param string $name
* @return string
*/
ModelsHelper::table(): void
Get
/**
* Get class if one exists
* @param string $name
* @return Model|null
*/
ModelsHelper::get(): void
Exists
/**
* Check if model exists
* @param string $name
* @return bool
*/
ModelsHelper::exists(): void