Skip to content

Instantly share code, notes, and snippets.

@rmccullagh
Created May 28, 2019 13:27
Show Gist options
  • Select an option

  • Save rmccullagh/efbc73526d3f24b3e2a93f9e011bbe34 to your computer and use it in GitHub Desktop.

Select an option

Save rmccullagh/efbc73526d3f24b3e2a93f9e011bbe34 to your computer and use it in GitHub Desktop.

Revisions

  1. rmccullagh created this gist May 28, 2019.
    31 changes: 31 additions & 0 deletions BeforeUsingDI.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php

    namespace App\Http\Api\Site\Progress;

    use Illuminate\Support\Facades\Redis;
    use Illuminate\Support\Facades\Log;

    use App\Http\Api\Constants\AmezmoApi;
    use App\Http\Api\BaseApiController;
    use App\Http\Api\Site\Progress\Models\ProgressReport;

    class SiteProgressController extends BaseApiController
    {
    public function __construct() {}

    public function report(ProgressReport $report)
    {
    if ($report->step === 0) {
    $package = ['percentage' => 100, 'message' => 'Failed'];
    Log::error('got error signal from container instance engine');
    } else {
    $package = ['percentage' => $report->step, 'message' => $report->message];
    }

    Log::debug('progress', $package);

    Redis::set(stubbedProgressKey() json_encode($package), 'EX', AmezmoApi::PROGRESS_MESSAGE_TTL);

    return view();
    }
    }