zeydkazanci03/laragetmodel
最新稳定版本:v2.0
Composer 安装命令:
composer require zeydkazanci03/laragetmodel
包简介
Laravel helper to load models via GetModel::run('ModelName')->method()
README 文档
README
Laravel package to call model methods via a facade:
use GetModel; $user = GetModel::run('User')->find(1); $user = GetModel::run(\App\Models\User::class)->someMethod();
Features
GetModel::run('ModelName')resolvesApp\Models\ModelNameby default.- You can pass a full class name (
\App\Models\User) if needed. - Configurable
base_model_namespace.
Requirements
- PHP >= 8.0 (compatible with PHP 8+)
- Laravel ^10.0
Installation (dev / local)
Add repository to your project's composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/YOUR_USER/laragetmodel" } ]
Then in your project:
composer require laragetmodel/laragetmodel:dev-main
Or use path repository during local testing.
Usage
After installation the package registers automatically (Laravel package discovery). You can also add provider/alias manually in config/app.php:
'providers' => [ Laragetmodel\GetModel\Providers\GetModelServiceProvider::class, ], 'aliases' => [ 'GetModel' => Laragetmodel\GetModel\Facades\GetModel::class, ],
Config publish (optional):
php artisan vendor:publish --provider="Laragetmodel\GetModel\Providers\GetModelServiceProvider" --tag="config"
Configuration
config/getmodel.php contains base_model_namespace (default App\\Models\\).
License
MIT
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-26