-
app/Jobs/CheckPackageUrlsForAvailability.php
Open in GitHubuse App\Notifications\NotifyAuthorOfUnavailablePackageUrl; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class CheckPackageUrlsForAvailability implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public function handle() { if ($this->package->author && $this->package->authorIsUser()) { $this->package->author->user->notify(new NotifyAuthorOfUnavailablePackageUrl($this->package)); } } }
-
app/Console/Commands/CheckPackageUrls.php
Open in GitHubuse App\Jobs\CheckPackageUrlsForAvailability as CheckPackageUrlsJob; use App\Package; use Illuminate\Console\Command; class CheckPackageUrls extends Command { public function handle() { $validPackages = Package::whereNull('marked_as_unavailable_at') ->with('author') ->get(); foreach ($validPackages as $package) { dispatch(new CheckPackageUrlsJob($package)); } } }