An idea I had, was to change the Concern to a Base Class.
This would make the API look much more natural imho:
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Podcast;
use Junges\TrackableJobs\Models\TrackedJob;
use Junges\TrackableJobs\TrackableJob;
class ProcessPodcastJob extends TrackableJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(Podcast $podcast)
{
parent::__construct($podcast);
// Add your code here.
}
public function handle()
{
//
}
}
VS:
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Junges\TrackableJobs\Concerns\Trackable;
use App\Models\Podcast;
use Junges\TrackableJobs\Models\TrackedJob;
class ProcessPodcastJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, Trackable {
__construct as __baseConstruct;
}
public function __construct(Podcast $podcast)
{
$this->__baseConstruct($podcast);
// Add your code here.
}
public function handle()
{
//
}
}
Hey 👋 this is actually one of the things I'm considering for v2. I'm not sure if I'll go with this yet, but I have to agree that the first one looks way better than using a trait.
Hi Mateus, thanks for this cool package!
An idea I had, was to change the Concern to a Base Class. This would make the API look much more natural imho:
VS:
What do you think?