Skip to content

Commit 516d34d

Browse files
committed
Create README.md
1 parent 83f876d commit 516d34d

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Laravel Advance Model
2+
Enhance the Laravel model creation with a simple command.
3+
The package is based on [Bootstrap 5](https://getbootstrap.com/) for the table UI and [htmx](https://htmx.org/docs/) for all the requests.
4+
5+
## Installation
6+
```bash
7+
composer require andreazorzi/laravel-advance-model
8+
```
9+
10+
## Usage
11+
Use the folowing command to create all the files connected with the modal.
12+
```bash
13+
php artisan advance:create-model <ClassName> {--type=<creation_type>} {--force}
14+
```
15+
The command will create the class based on the class name (in PascalCase and singular form) and the creation type method (default: complete).
16+
You can also add the force flag to overwrite all files.
17+
18+
### Creation types table
19+
| types \ files | model | controller | requests * | page | filter | web *| modal |
20+
|-----------------|-------|------------|----------|------|--------|-----|-------|
21+
| only-model | x | | | | | | |
22+
| with-controller | x | x | x | | | | |
23+
| with-page | x | x | x | x | x | x | |
24+
| complete | x | x | x | x | x | x | x |
25+
26+
\* request and web files are route files, in order to succesfully modify those files, you have to insert some placeholder comments like below
27+
28+
#### routes/request.php
29+
Int this file there are two placeholder `// End Controllers Imports` and `// End Models Routes`
30+
```php
31+
<?php
32+
33+
use Illuminate\Support\Facades\Route;
34+
// End Controllers Imports
35+
36+
Route::prefix('admin')->group(function () {
37+
Route::middleware(['auth'])->group(function () {
38+
Route::resource('users', UserController::class);
39+
// End Models Routes
40+
});
41+
});
42+
```
43+
44+
#### routes/web.php
45+
Int this file there is one placeholder `// End Models Routes`
46+
```php
47+
<?php
48+
49+
use Illuminate\Support\Facades\Route;
50+
51+
Route::prefix('admin')->group(function () {
52+
Route::middleware(['auth'])->group(function () {
53+
Route::view('users', 'backoffice.users')->name('backoffice.users');
54+
// End Models Routes
55+
});
56+
});
57+
```
58+
59+
## The MIT License (MIT)
60+
61+
Copyright © 2024 Andrea Zorzi <[email protected]>
62+
63+
Permission is hereby granted, free of charge, to any person
64+
obtaining a copy of this software and associated documentation
65+
files (the “Software”), to deal in the Software without
66+
restriction, including without limitation the rights to use,
67+
copy, modify, merge, publish, distribute, sublicense, and/or sell
68+
copies of the Software, and to permit persons to whom the
69+
Software is furnished to do so, subject to the following
70+
conditions:
71+
72+
The above copyright notice and this permission notice shall be
73+
included in all copies or substantial portions of the Software.
74+
75+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
76+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
77+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
78+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
79+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
80+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
81+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
82+
OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)