1. Go to this page and download the library: Download pancake423/laravel-sfr 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/ */
pancake423 / laravel-sfr example snippets
namespace App\Http\Requests;
use Pancake423\StaticFormRequest\StaticFormRequest;
use Pancake423\StaticFormRequest\Validate;
use Pancake423\StaticFormRequest\Message;
class LoginRequest extends StaticFormRequest
{
public function authorize()
{
// define the authorize method like you would on a normal FormRequest.
// note that if you need to access the actual form request (ie. to take)
// advantage of route-model binding, you'll have to use
// $this->form() instead of just $this.
return true;
}
#[Validate("
namespace App\Http\Controllers;
use App\Http\Requests\LoginRequest;
class AuthController extends Controller {
public function login(LoginRequest $request)
{
// just type-hint the LoginRequest and let Laravel magic
// take care of the rest!
// the data is already validated by the time it gets to your controller.
// if you need the data as an array, ie. to pass to an Eloquent model,
// use $request->toArray().
dd($request->username, $request->password, $request->toArray());
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.