PHP code example of irealworlds / laravel-attribute-requests

1. Go to this page and download the library: Download irealworlds/laravel-attribute-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/ */

    

irealworlds / laravel-attribute-requests example snippets


use Ireal\AttributeRequests\Http\Request;

class PostStoreRequest extends Request
{
    public string $title;
    public string|null $body;
}

public function store(PostStoreRequest $request)
{
    $post = Post::query()->create([
        'title' => $request->title, // IDE knows exactly what type of variable $request->title is here
        'body' => $request->body
    ]);
}
sh
php artisan vendor:publish --tag=configuration --provider=AttributeRequestServiceProvider