PHP code example of expertsystemsau / laravel-conditional-requests

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

    

expertsystemsau / laravel-conditional-requests example snippets


Route::get('/articles/{article}', ShowArticle::class)
    ->middleware('conditional');

namespace App\Models;

use ExpertSystems\ConditionalRequests\Concerns\HasConditionalValidator;
use ExpertSystems\ConditionalRequests\Contracts\ProvidesConditionalValidator;
use Illuminate\Database\Eloquent\Model;

class Article extends Model implements ProvidesConditionalValidator
{
    use HasConditionalValidator;
}

Route::patch('/articles/{article}', UpdateArticle::class)
    ->middleware('conditional: