Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/illegalstudio/laravel-utils
https://github.com/illegalstudio/laravel-utils
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/illegalstudio/laravel-utils
- Owner: illegalstudio
- License: mit
- Created: 2023-03-28T09:10:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-14T17:13:43.000Z (over 1 year ago)
- Last Synced: 2024-04-25T20:04:13.349Z (8 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Utils
This repository contains a collection of useful classes and traits for Laravel.
It is used mainly for [illegal studio](https://github.com/illegalstudio) projects.
## HasPrefix
This traits can be used to add a prefix to your model's table name.
```php
class MyModel extends Model
{
use HasPrefix;
protected $prefix = 'my_prefix_';
}
```Alternatively you can use the `getPrefix` method to set the prefix.
This is useful if you want to set the prefix dynamically.
```php
class MyModel extends Model
{
use HasPrefix;
public function getPrefix()
{
return config('my.prefix');
}
}
```