PHP code example of svnwa / laravel-strapi
1. Go to this page and download the library: Download svnwa/laravel-strapi 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/ */
svnwa / laravel-strapi example snippets
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->paginate(0,20,true)
->fields(['name','adress','tel'])
->sortBy([
['name','asc'],
]
->filterBy([
['[name][$contains]','pizza'],
])
->populate()
->locale('de')
->withFullUrls()
->publicationState('preview')
->get();
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')->get();
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::entry('restaurants',999)->get();
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->sortBy([
['id','asc'],
['name','desc'],
]);
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->paginate(0,20,true);
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->filterBy([
['[name][$contains]','pizza'],
]);
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->fields(['name','adress','tel']);
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->populate();
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->populate(['menu','customers']);
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->publicationState('preview');
use Svnwa\LaravelStrapi\Facades\Strapi;
$listOfRestaurants = Strapi::collection('restaurants')
->locale('de');
bash
php artisan vendor:publish --provider="svnwa\laravel-strapi\LaravelStrapiServiceProvider" --tag="laravel-strapi"
STRAPI_CACHE_STORAGE_TIME
api/restaurants?pagination[start]=0&pagination[limit]=20&pagination[withCount]=true
api/restaurants?populate=*