PHP code example of brayancaro / laravel-api-rule
1. Go to this page and download the library: Download brayancaro/laravel-api-rule 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/ */
brayancaro / laravel-api-rule example snippets
# Create a rule
use BrayanCaro\ApiRule\ApiRule;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
class DummyRule extends ApiRule
{
protected function pullResponse($value): Response
{
return Http::get("dummy.com/$value");
}
}
public function store(Request $request)
{
$validated = $request->validate([
'some_attribute' => ['