PHP code example of mbvienasbaitas / strapi-laravel-client
1. Go to this page and download the library: Download mbvienasbaitas/strapi-laravel-client 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/ */
mbvienasbaitas / strapi-laravel-client example snippets
use VienasBaitas\Strapi\Client\Contracts\Requests\Collection\IndexRequest;
use VienasBaitas\Strapi\Client\Laravel\Facades\Strapi;
$collection = Strapi::collection('pages');
$response = $collection->index(IndexRequest::make());
use VienasBaitas\Strapi\Client\Client;
use VienasBaitas\Strapi\Client\Contracts\Requests\Collection\IndexRequest;
class BlogController
{
public function index(Client $client)
{
$collection = $client->collection('pages');
return $collection->index(IndexRequest::make());
}
}
use VienasBaitas\Strapi\Client\Contracts\Requests\Collection\IndexRequest;
use VienasBaitas\Strapi\Client\Laravel\Facades\Strapi;
$client = Strapi::client('custom');
$collection = $client->collection('pages');
$response = $collection->index(IndexRequest::make());
use VienasBaitas\Strapi\Client\Contracts\Requests\Collection\IndexRequest;
use VienasBaitas\Strapi\Client\Laravel\Contracts\Factory;
class BlogController
{
public function index(Factory $factory)
{
$collection = $factory->client('custom')->collection('pages');
return $collection->index(IndexRequest::make());
}
}