PHP code example of dees040 / persisting-requests

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

    

dees040 / persisting-requests example snippets


dees040\PersistingRequests\ServiceProvider::class,




namespace App\Http\Controllers;

use App\Http\Requests\FooBarRequest;

class ActivationController extends Controller
{
    public function activate(FooBarRequest $request)
    {
        $request->persist();

        return view('home');
    }
}



namespace App\Http\Requests;

use dees040\PersistingRequests\PersistingRequest;

class FooBarRequest extends PersistingRequest
{
    /**
     * Persist the request.
     *
     * @return void
     */
    public function persisting(ActivationManager $manager)
    {
        $manager->activate($this->user());
    }
}

php artisan make:persist FooBarRequest