Skip to content

Commit 3a22825

Browse files
committed
Updated README file
1 parent 408333d commit 3a22825

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
# laravel-utils
1+
# Laravel Utils
2+
3+
This repository contains a collection of useful classes and traits for Laravel.
4+
5+
It is used mainly for [illegal studio](https://github.com/illegalstudio) projects.
6+
7+
## HasPrefix
8+
9+
This traits can be used to add a prefix to your model's table name.
10+
11+
```php
12+
class MyModel extends Model
13+
{
14+
use HasPrefix;
15+
16+
protected $prefix = 'my_prefix_';
17+
}
18+
```
19+
20+
Alternatively you can use the `getPrefix` method to set the prefix.
21+
22+
This is useful if you want to set the prefix dynamically.
23+
24+
```php
25+
class MyModel extends Model
26+
{
27+
use HasPrefix;
28+
29+
public function getPrefix()
30+
{
31+
return config('my.prefix');
32+
}
33+
}
34+
```

0 commit comments

Comments
 (0)