PHP code example of ironshark / laravel-deliverable

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

    

ironshark / laravel-deliverable example snippets


class Article extends \Illuminate\Database\Eloquent\Model {
    use IronShark\Deliverable\DeliverableTrait;
}

$file = File::create(['name' => 'filename']);
$admin = \App\User::where('name', 'admin')->first();
    
$file->deliver(\App\User::all()); // deliver file to all users
$file->deliver(1, 5); // deliver files to user with id `1`, priority = `5`

$file->setDelivered(); // mark file as deliverd to logged in user
$file->setDelivered(true, $admin); // mark file as deliverd to admin user

$file->isDelivered(); // check whether current item was delivered to current user (`true`|`false`)
$file->isDelivered($admin); // check whether current item was delivered to admin

$file->cancelDelivery(); // remove delivery tasks for current user
$file->cancelDelivery($admin); // remove delivery tasks for admin
$file->cancelDelivery([1,5,9,8]); // remove delivery tasks for specified user ids
bash
php artisan vendor:publish --provider="IronShark\Deliverable\DeliverableServiceProvider"
php artisan migrate