1. Go to this page and download the library: Download hxm/laravel-planning 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/ */
use HXM\LaravelPlanning\LaravelPlanning;
public function boot()
{
LaravelPlanning::addResources([\App\User::class]);
}
use HXM\LaravelPlanning\Traits\HasPlanResourceInstance;
use HXM\LaravelPlanning\Contracts\PlanResourceInstance;
class User extends Authenticatable implements PlanResourceInstance
{
use HasPlanResourceInstance;
}
use App\User;
use HXM\LaravelPlanning\Actions\Creations\CreatePlanOrderCalculator;
use HXM\LaravelPlanning\Models\Plan;
$user = User::find(1);
$plan = Plan::find(1);
$action = new CreatePlanOrderCalculator($user, $plan);
$startAt = now();
$numberOfCycle = 1;
$planOrder = $action->handle($startAt, $numberOfCycle);
// Save the plan order instance to the database
$planOrder->save();
// Get Items
$planOrder->getItems();
// Get Cycle list
$planOrder->getCycles();
// Optionally, initialize a payment for the plan order
// This can be done before or after saving the plan order.
use Illuminate\Database\Eloquent\Model;
use HXM\LaravelPlanning\Models\PlanCycle;
use HXM\LaravelPlanning\Actions\Updates\UpdatePlanCycleStatus;
UpdatePlanCycleStatus::handle(PlanCycle $planCycle,int $newStatus, Model $resource);
// Or
UpdatePlanCycleStatus::handleByReferable(Model $payment, int $newStatus);