ibnu
1 year ago
8 changed files with 457 additions and 348 deletions
@ -0,0 +1,36 @@
|
||||
<?php |
||||
|
||||
namespace App\Jobs; |
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
use Illuminate\Support\Facades\Queue; |
||||
use App\Helpers\MasterFunctionsHelper; |
||||
use App\Models\Project; |
||||
|
||||
class ProcessSCurve extends Job |
||||
{ |
||||
protected $project; |
||||
/** |
||||
* Create a new job instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct(Project $project) |
||||
{ |
||||
$this->project = $project; |
||||
} |
||||
|
||||
/** |
||||
* Execute the job. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function handle() |
||||
{ |
||||
$data = MasterFunctionsHelper::CalculateSCurve($this->project->id); |
||||
|
||||
$this->project->scurve = json_encode($data); |
||||
$this->project->calculation_status = true; |
||||
$this->project->save(); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
class CreateJobsTable extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('jobs', function (Blueprint $table) { |
||||
$table->bigIncrements('id'); |
||||
$table->string('queue')->index(); |
||||
$table->longText('payload'); |
||||
$table->unsignedTinyInteger('attempts'); |
||||
$table->unsignedInteger('reserved_at')->nullable(); |
||||
$table->unsignedInteger('available_at'); |
||||
$table->unsignedInteger('created_at'); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('jobs'); |
||||
} |
||||
} |
Loading…
Reference in new issue