| Package Data | |
|---|---|
| Maintainer Username: | pionl |
| Maintainer Contact: | martin.kluska@imakers.cz (Martin Kluska) |
| Package Create Date: | 2016-10-27 |
| Package Last Update: | 2016-10-27 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-20 15:01:02 |
| Package Statistics | |
|---|---|
| Total Downloads: | 17 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
You can provide overriding of your classes via config file (a list of classes defined by config key - like custom Eloquent model). With this you can work with expected model but add a posibility to allow extending of your base classes.
In default tries to load classes from the classes.php config file.
Example config (classes.php in config folder):
<?php
return [
"user" => App\\Models\\User::class
];
$userGate = ClassGate::gate("user");
$users = $userGate->all() // will call User::all()
or shortcut
// will call User::all()
$users = ClassGate::gate("user")->all();
$userGate = ClassGate::gate("user");
$user = $userGate->newInstance();
or shortcut
$user = ClassGate::instance("user");
$user = $userGate->theClass();
$userGate = ClassGate::gate("user");
or shortcut
$userClass = ClassGate::objectClass("user");
You can provide your own file or "array" path to the config via ClassGate::setConfigPath("models.list") which will find classes in models file and list array entry.
Example config (models.php in config folder):
<?php
return [
"othersKeys" : "...",
"list" => [
"user" => App\\Models\\User::class
]
];
ClassGate instanceClassGate::user() that will call ClassGate::gate("user")