PHP code example of summonshr / requests
1. Go to this page and download the library: Download summonshr/requests library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
summonshr / requests example snippets
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Summonshr\Requests\Contracts\UniversalRequestInterface;
class CreateApplication extends FormRequest implements UniversalRequestInterface
{
// To call on specific method
const REQUEST_METHOD = 'GET';
// To call on specific action
const ACTION = 'create_application';
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
public function process()
{
// Process your requests here
}
}
Route::any('/resource', function (UniversalRequestInterface $request) {
return $request->process();
});