This is a package for quick integration with Pictino for storing records in a more usable fashion.
- Install composer package:
composer require wearebraid/piction
- Install config file
php artisan vendor:publish --provider="Wearebraid\Piction\PictionServiceProvider"
- Add the following items to your Laravel
.env
file:
PICTION_HOST=http://<your-host-here>/piction/
PICTION_USERNAME=username
PICTION_PASSWORD=password
- Add service provider and facade to your app's config:
config/app.php
...
'providers' => [
...
Wearebraid\Piction\PictionServiceProvider::class,
...
],
'aliases' => [
...
'Piction' => Wearebraid\Piction\Facades\Piction::class,
...
],
...
host
: This is set to pull from the.env
file to set the host URL for your Piction installuser
: This is set to pull from the.env
file to set the desired user for retrieving data from Pictionpass
: This is set to pull from the.env
file to set the desired user's password for retrieving data from Pictionendpoint
: Default is!soap.jsonget
, you should not need to change this as most of the functionality is relying on JSON data returned from Piction.use_scout
: Default isfalse
If you choose to use Laravel's Scout set this totrue
. More details on using Scout and the Scout Record class below.timeout
: Default is300
, this is the number of seconds a Piction call will take before Guzzle will timeout.
Why use Scout? Because it is AWESOME! Follow the Scout setup. Once you have it configured, in config/piction.php
set 'use_scout' => true
From then on, instead of using Wearebraid\Piction\Models\Record
as your main record model, switch to Wearebraid\Piction\Models\Scout\Record
This model extends the normal record model adding the Searchable
functions for indexing the records for quick searches. Then from within a controller you can then use Record::search('spiders')->paginate(20);
php artisan piction:collections
This is the main script you will run daily Stores latest collection info to database and adds any new collections. These records will also keep track of the last updated time for the collection. Collections that have been removed from Piction will be deleted from the database as well as all records in that collection. This script also:- Goes through each collection and requests the latest records for each.
- Requests deleted UMO's and removes records that no longer exist on Piction.
php artisan piction:records collection_id
This command will connect to Piction and retrieve ALL records since the last run for a spcific collection. A collection id is required to run this script.php artisan piction:deleted
Since Piction doesn't support webhooks, we can get the latest data each day but we don't know what's been deleted. That's where this script comes in. It connects to Piction retrieving a list of all deleted UMO's and then deletes any of those found in the database.