Download the PHP package tomatophp/laravel-tomato without Composer
On this page you can find all versions of the php package tomatophp/laravel-tomato. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-tomato

Laravel Tomato
Basic Laravel Helpers for requests and controllers build by TomatoPHP
Installation
Features
- [x]
Tomato::menu()inject and handle menus across your application - [x]
Tomato::widget()inject and handle widgets across your application - [x]
Tomato::slot()inject and handle slots across your application - [x]
Tomato::request()handle and validate requests - [x]
Tomato::response()handle api responses
Usage
you can use the helper by Facade class or by using the helper function
or just
Register Components
you can register your menu, widget, or slot in your service provider boot() method
you can register any type of component and we will check it and handle it for you
all components have a macroable methods to add more functionality to it.
Get Components
you can get your components like this
it will return an array of registered components for you
Request
you can use the request helper to handle and validate your requests like this
🔁 Index Request
this method returns view or JsonResponse based on the request type. and we get the request type by check if the route has auth:sanctum middleware or not.
this method accept some arguments:
requestthe request objectmodelthe model you want to getviewthe view you want to returntablethe table class you want to usedatathe data you want to pass to the viewapiif you want to return JsonResponse or notresourceresource class to resource your returned dataqueryif you want to add some query to the modelfiltersif you want to add some filters to the table
🔁 JSON Request
this method return only json response of the model to make it easy to access it with x-splade-select or x-tomato-admin-select
this method accept some arguments:
requestthe request objectmodelthe model you want to getdatathe data you want to pass to the viewpaginateif you want to paginate the response or notqueryif you want to add some query to the modelfiltersif you want to add some filters to the table
🔁 Get Request
this method returns view or JsonResponse based on the request type. and we get the request type by check if the route has auth:sanctum middleware or not.
this method accept some arguments:
modelthe model you want to getviewthe view you want to returndatathe data you want to pass to the viewhasMediaif you want to get the media of the model or notcollection [array]the media collection you want to get as array take true if it's multi or false if it's singleattach [array]to attach some data to the modelapiif you want to return JsonResponse or notresourceresource class to resource your returned dataqueryif you want to add some query to the model
🔁 Store Request
this method returns RedirectResponse or JsonResponse based on the request type. and we get the request type by check if the route has auth:sanctum middleware or not.
this method accept some arguments:
requestthe request objectmodelthe model you want to getvalidationthe validation rules you want to usemessagethe message you want to return with the responsevalidationErrorthe message you want to return if the validation failedredirectthe redirect route you want to redirect tohasMediaif you want to get the media of the model or notcollection [array]the media collection you want to get as array take true if it's multi or false if it's singleapiif you want to return JsonResponse or not
🔁 Update Request
this method returns RedirectResponse or JsonResponse based on the request type. and we get the request type by check if the route has auth:sanctum middleware or not.
this method accept some arguments:
requestthe request objectmodelthe model you want to getvalidationthe validation rules you want to usemessagethe message you want to return with the responsevalidationErrorthe message you want to return if the validation failedredirectthe redirect route you want to redirect tohasMediaif you want to get the media of the model or notcollection [array]the media collection you want to get as array take true if it's multi or false if it's singleapiif you want to return JsonResponse or not
🔁 Destroy Request
this method returns RedirectResponse or JsonResponse based on the request type. and we get the request type by check if the route has auth:sanctum middleware or not.
this method accept some arguments:
modelthe model you want to getmessagethe message you want to return with the responseredirectthe redirect route you want to redirect toapiif you want to return JsonResponse or not
Request With Media
to make media handling work you must install spatie/laravel-medialibrary package and run the migration
and your model must use HasMedia trait
Handel Alerts
and we have handel Toaster for you if you are using Splade it will working automatically and if you have yoeunes/toastr package it will working fine too. or you can use fetch toaster variable from session to get the flash messages.
Support
you can join our discord server to get support TomatoPHP
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
Please see SECURITY for more information about security.
Credits
- Fady Mondy
License
The MIT License (MIT). Please see License File for more information.