PHP code example of sirajcse / laravel-safe-submit

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

    

sirajcse / laravel-safe-submit example snippets


SirajCSE\LaravelSafeSubmit\SafeSubmitServiceProvider::class,

'SafeSubmit' => SirajCSE\LaravelSafeSubmit\SafeSubmit::class,

    \SirajCSE\LaravelSafeSubmit\Middleware\GenerateSafeSubmitToken::class

    protected $middlewareGroups = [
            'web' => [
                ...
                \SirajCSE\LaravelSafeSubmit\Middleware\GenerateSafeSubmitToken::class,
            ],
        ];

        use SirajCSE\LaravelSafeSubmit\SafeSubmit;
        use SirajCSE\LaravelSafeSubmit\Middleware\HandleSafeSubmit;

    use SirajCSE\LaravelSafeSubmit\SafeSubmit;
    use SirajCSE\LaravelSafeSubmit\Middleware\HandleSafeSubmit;
    
    class UserController extends Controller
    {
        public function __construct()
        {
            $this->middleware(HandleSafeSubmit::class)->only('store');
        }
        
  
        public function store(Request $request, SafeSubmit $safeSubmit)
        {
            $user=User::create($data);
            return $safeSubmit->intended(route('users.show', $user->id));
        }
    }

        @safesubmit