Created
February 12, 2023 22:46
-
-
Save aleksandertabor/2cad93e2ca299485298b51f5d004c64f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Jobs\Examples; | |
use App\Models\User; | |
use Carbon\Carbon; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Queue\SerializesModels; | |
use MichaelLedin\LaravelJob\FromParameters; | |
class ExampleJob implements ShouldQueue, FromParameters | |
{ | |
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |
/** | |
* Create a new job instance. | |
* | |
* @return void | |
*/ | |
public function __construct(public string $videoName, public Carbon $releasedAt, public User $user) | |
{ | |
// | |
} | |
/** | |
* Execute the job. | |
* | |
* @return void | |
*/ | |
public function handle() | |
{ | |
dd($this->user); | |
// dd('Example job handle'); | |
} | |
public static function fromParameters(...$parameters) | |
{ | |
return new self($parameters[0], Carbon::parse($parameters[1]), User::find($parameters[2])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment