You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is encouraged that you explore this package, it is very straight forward and simple so it is easy to integrate what it has to offer for your use case.
65
+
As the logic you implement to use Actions & Requests may be different to others, as well as other practises.
66
+
However, lets go over some basic use cases.
67
+
68
+
### Update a Blog
69
+
```php
70
+
use App\Http\Controllers\Controller;
71
+
use Illuminate\Http\RedirectResponse;
72
+
use SethSharp\BlogCrud\Models\Blog\Blog;
73
+
use SethSharp\BlogCrud\Actions\Blogs\UpdateBlogAction;
74
+
use SethSharp\BlogCrud\Requests\Blogs\UpdateBlogRequest;
75
+
76
+
class UpdateBlogController extends Controller
77
+
{
78
+
public function __invoke(Blog $blog, UpdateBlogRequest $updateBlogRequest, UpdateBlogAction $updateBlogAction): RedirectResponse
This is an example `UpdateBlogController`, using all the files from the package; `Blog`, `UpdateBlogRequest` & `UpdateBlogAction`.
91
+
Reading each of these files will ive you an understanding of what they expect - so its up to you to ensure you pass the correct information.
92
+
93
+
### Tips
94
+
If you wanted to add another column such as `publish_at` to define when to publish the blog through a console command, you just need to define this
95
+
attribute by extending the rules in the `UpdateBlogRequest`, then passing that data to `UpdateBlogAction` it will automatically assign that variable. Any
96
+
further logic will need to be manually done by yourself.
0 commit comments