code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function prependToHaystack(StackableJob|Collection|array $jobs, int $delayInSeconds = 0, ?string $queue = null, ?string $connection = null): static { $this->haystack->addJobs($jobs, $delayInSeconds, $queue, $connection, true); return $this; }
Prepend jobs to the haystack. @return $this
prependToHaystack
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function setHaystackBaleId(int $haystackBaleId): static { $this->haystackBaleId = $haystackBaleId; return $this; }
Set the Haystack bale ID. @return $this
setHaystackBaleId
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function pauseHaystack(int|CarbonInterface $delayInSecondsOrCarbon): static { if (config('haystack.process_automatically', false) === false) { throw new StackableException('The "pauseHaystack" method is unavailable when "haystack.process_automatically" is disabled. Use the "nextJob" with a delay provided instead.'); } $resumeAt = CarbonHelper::createFromSecondsOrCarbon($delayInSecondsOrCarbon); $this->haystack->pause($resumeAt); // We need to make sure that we delete the current haystack bale to stop it // from being processed when the haystack is resumed. HaystackBale::query()->whereKey($this->getHaystackBaleId())->delete(); return $this; }
Pause the haystack. We also need to delete the current row. @return $this @throws StackableException
pauseHaystack
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function setHaystackData(string $key, mixed $value, ?string $cast = null): static { $this->haystack->setData($key, $value, $cast); return $this; }
Set data on the haystack. @return $this
setHaystackData
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function setHaystackModel(Model $model, string $key): static { $this->haystack->setModel($model, $key); return $this; }
Set a shared model @return $this @throws \Sammyjo20\LaravelHaystack\Exceptions\HaystackModelExists
setHaystackModel
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function allHaystackData(): Collection { return $this->haystack->allData(); }
Get all data on the haystack. @return mixed
allHaystackData
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function setHaystackBaleAttempts(int $attempts): static { $this->haystackBaleAttempts = $attempts; return $this; }
Set the haystack bale attempts. @return $this
setHaystackBaleAttempts
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function getHaystackBaleRetryUntil(): ?int { return $this->haystackBaleRetryUntil; }
Get the haystack bale retry-until.
getHaystackBaleRetryUntil
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function setHaystackBaleRetryUntil(?int $retryUntil): static { $this->haystackBaleRetryUntil = $retryUntil; return $this; }
Set the haystack bale retry-until. @return $this
setHaystackBaleRetryUntil
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function getHaystackOptions(): HaystackOptions { return $this->haystack->options; }
Get the options on the Haystack
getHaystackOptions
php
Sammyjo20/laravel-haystack
src/Concerns/Stackable.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php
MIT
public function addThen(Closure|callable $closure): static { return $this->addCallback('onThen', $closure); }
Add a "then" callback @return $this @throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException
addThen
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function addCatch(Closure|callable $closure): static { return $this->addCallback('onCatch', $closure); }
Add a "catch" callback @return $this @throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException
addCatch
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function addFinally(Closure|callable $closure): static { return $this->addCallback('onFinally', $closure); }
Add a "finally" callback @return $this @throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException
addFinally
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function addPaused(Closure|callable $closure): static { return $this->addCallback('onPaused', $closure); }
Add a "paused" callback @return $this @throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException
addPaused
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
protected function addCallback(string $property, Closure|callable $closure): static { $this->$property[] = new SerializableClosure(ClosureHelper::fromCallable($closure)); return $this; }
Add a callback to a given property @return $this @throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException
addCallback
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function isEmpty(): bool { return empty($this->onThen) && empty($this->onCatch) && empty($this->onFinally) && empty($this->onPaused); }
Check if the callbacks are empty.
isEmpty
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function isNotEmpty(): bool { return ! $this->isEmpty(); }
Check if the callbacks are not empty
isNotEmpty
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function toSerializable(): ?static { return $this->isNotEmpty() ? $this : null; }
Convert the object ready to be serialized @return $this|null
toSerializable
php
Sammyjo20/laravel-haystack
src/Data/CallbackCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/CallbackCollection.php
MIT
public function __set(string $name, $value): void { $this->$name = $value; }
Allow additional properties to be added to Haystack options.
__set
php
Sammyjo20/laravel-haystack
src/Data/HaystackOptions.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/HaystackOptions.php
MIT
public function add(Closure|array|callable $value): static { if (is_array($value)) { $value = static fn () => $value; } $this->data[] = new SerializableClosure(ClosureHelper::fromCallable($value)); return $this; }
Add the middleware to the collection @return $this @throws PhpVersionNotSupportedException
add
php
Sammyjo20/laravel-haystack
src/Data/MiddlewareCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/MiddlewareCollection.php
MIT
public function toMiddlewareArray(): array { return collect($this->data) ->map(function (SerializableClosure $closure) { $result = $closure(); return is_array($result) ? $result : [$result]; }) ->flatten() ->filter(fn ($value) => is_object($value)) ->toArray(); }
Call the whole middleware stack and convert it into an array
toMiddlewareArray
php
Sammyjo20/laravel-haystack
src/Data/MiddlewareCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/MiddlewareCollection.php
MIT
public function isEmpty(): bool { return empty($this->data); }
Check if the middleware is empty
isEmpty
php
Sammyjo20/laravel-haystack
src/Data/MiddlewareCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/MiddlewareCollection.php
MIT
public function isNotEmpty(): bool { return ! $this->isEmpty(); }
Check if the middleware is not empty
isNotEmpty
php
Sammyjo20/laravel-haystack
src/Data/MiddlewareCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/MiddlewareCollection.php
MIT
public function toSerializable(): ?static { return $this->isNotEmpty() ? $this : null; }
Convert the object ready to be serialized @return $this|null
toSerializable
php
Sammyjo20/laravel-haystack
src/Data/MiddlewareCollection.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/MiddlewareCollection.php
MIT
public function toDatabaseRow(Haystack $haystack): array { $now = Carbon::now(); return $haystack->bales()->make([ 'created_at' => $now, 'updated_at' => $now, 'job' => $this->job, 'delay' => $this->delayInSeconds, 'on_queue' => $this->queue, 'on_connection' => $this->connection, 'priority' => $this->priority, ])->getAttributes(); }
Convert to a haystack bale for casting.
toDatabaseRow
php
Sammyjo20/laravel-haystack
src/Data/PendingHaystackBale.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Data/PendingHaystackBale.php
MIT
public static function createFromSecondsOrCarbon(int|CarbonInterface $value): CarbonImmutable { return is_int($value) ? CarbonImmutable::now()->addSeconds($value) : $value->toImmutable(); }
Create a date from seconds or from Carbon.
createFromSecondsOrCarbon
php
Sammyjo20/laravel-haystack
src/Helpers/CarbonHelper.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Helpers/CarbonHelper.php
MIT
public static function validateCast(mixed $value, ?string $cast = null): void { if (is_null($cast) && is_string($value) === false && is_int($value) === false) { throw new InvalidArgumentException('You must specify a cast if the value is not a string or integer.'); } }
Throw an exception if the cast is invalid for the data type.
validateCast
php
Sammyjo20/laravel-haystack
src/Helpers/DataValidator.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Helpers/DataValidator.php
MIT
public static function maxAttemptsExceededException($job): Throwable { return new MaxAttemptsExceededException( $job::class.' has been attempted too many times or run too long. The job may have previously timed out.' ); }
Get the max attempts exceeded exception.
maxAttemptsExceededException
php
Sammyjo20/laravel-haystack
src/Helpers/ExceptionHelper.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Helpers/ExceptionHelper.php
MIT
public function handle(StackableJob $job, $next): void { $exceededRetryUntil = false; $maxTries = null; if (is_int($job->getHaystackBaleRetryUntil())) { $exceededRetryUntil = now()->greaterThan(CarbonImmutable::parse($job->getHaystackBaleRetryUntil())); } else { $maxTries = $job->tries ?? 1; } $exceededLimit = (isset($maxTries) && $job->getHaystackBaleAttempts() >= $maxTries) || $exceededRetryUntil === true; if ($exceededLimit === true) { $exception = ExceptionHelper::maxAttemptsExceededException($job); $job->fail($exception); throw $exception; } $next($job); }
Check if we have exceeded the attempts. @throws \Throwable
handle
php
Sammyjo20/laravel-haystack
src/Middleware/CheckAttempts.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Middleware/CheckAttempts.php
MIT
public function handle(StackableJob $job, $next): void { if ($job->getHaystack()->finished === true) { return; } $next($job); }
Stop processing job if the haystack has finished.
handle
php
Sammyjo20/laravel-haystack
src/Middleware/CheckFinished.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Middleware/CheckFinished.php
MIT
public function handle(StackableJob $job, $next): void { $haystack = $job->getHaystack(); // First we'll increment the bale attempts. $haystack->incrementBaleAttempts($job); // When the "retryUntil" method is used we need to store the timestamp // that was generated by the queue worker. if the job is paused and // retried later we will resolve this timestamp and then check if // it has expired from the original queue push. if (method_exists($job, 'retryUntil') && is_null($job->getHaystackBaleRetryUntil())) { $retryUntil = $job->job?->retryUntil(); if (is_int($retryUntil)) { $haystack->setBaleRetryUntil($job, $retryUntil); } } $next($job); }
Increment the processed attempts of a given job.
handle
php
Sammyjo20/laravel-haystack
src/Middleware/IncrementAttempts.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Middleware/IncrementAttempts.php
MIT
protected static function newFactory() { return HaystackFactory::new(); }
Create a new factory instance for the model. @return \Illuminate\Database\Eloquent\Factories\Factory
newFactory
php
Sammyjo20/laravel-haystack
src/Models/Haystack.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/Haystack.php
MIT
public function getStartedAttribute(): bool { return $this->started_at instanceof CarbonImmutable; }
Denotes if the haystack has started.
getStartedAttribute
php
Sammyjo20/laravel-haystack
src/Models/Haystack.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/Haystack.php
MIT
public function getFinishedAttribute(): bool { return $this->finished_at instanceof CarbonImmutable; }
Denotes if the haystack has finished.
getFinishedAttribute
php
Sammyjo20/laravel-haystack
src/Models/Haystack.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/Haystack.php
MIT
public function getConnectionName(): string { return config('haystack.db_connection'); }
Get the current connection name for the model.
getConnectionName
php
Sammyjo20/laravel-haystack
src/Models/Haystack.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/Haystack.php
MIT
protected static function newFactory() { return HaystackBaleFactory::new(); }
Create a new factory instance for the model. @return \Illuminate\Database\Eloquent\Factories\Factory
newFactory
php
Sammyjo20/laravel-haystack
src/Models/HaystackBale.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackBale.php
MIT
public function haystack(): BelongsTo { return $this->belongsTo(Haystack::class); }
The Haystack this row belongs to.
haystack
php
Sammyjo20/laravel-haystack
src/Models/HaystackBale.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackBale.php
MIT
public function getConnectionName(): string { return config('haystack.db_connection'); }
Get the current connection name for the model.
getConnectionName
php
Sammyjo20/laravel-haystack
src/Models/HaystackBale.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackBale.php
MIT
protected static function newFactory() { return HaystackDataFactory::new(); }
Create a new factory instance for the model. @return \Illuminate\Database\Eloquent\Factories\Factory
newFactory
php
Sammyjo20/laravel-haystack
src/Models/HaystackData.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackData.php
MIT
public function haystack(): BelongsTo { return $this->belongsTo(Haystack::class); }
The Haystack this row belongs to.
haystack
php
Sammyjo20/laravel-haystack
src/Models/HaystackData.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackData.php
MIT
public function setCastAttribute(?string $cast): void { if (! is_null($cast)) { $this->casts = ['value' => $cast]; } $this->attributes['cast'] = $cast; $this->attributes['value'] = null; }
Set the cast attribute and apply the casts.
setCastAttribute
php
Sammyjo20/laravel-haystack
src/Models/HaystackData.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackData.php
MIT
public function getConnectionName(): string { return config('haystack.db_connection'); }
Get the current connection name for the model.
getConnectionName
php
Sammyjo20/laravel-haystack
src/Models/HaystackData.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Models/HaystackData.php
MIT
public function __construct(public string $key) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AddCountrySingerJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AddCountrySingerJob.php
MIT
public function handle() { $this->setHaystackModel(CountrySinger::first(), $this->key); $this->nextJob(); }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AddCountrySingerJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AddCountrySingerJob.php
MIT
public function __construct(public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AddNextOrderCheckCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AddNextOrderCheckCacheJob.php
MIT
public function handle() { cache()->put('order', array_merge(cache()->get('order', []), [$this->value])); $this->prependToHaystack(new OrderCheckCacheJob($this->value)); $this->nextJob(); }
Execute the job. @return void @throws \Psr\Container\ContainerExceptionInterface @throws \Psr\Container\NotFoundExceptionInterface @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AddNextOrderCheckCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AddNextOrderCheckCacheJob.php
MIT
public function __construct(public int|CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AlwaysLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AlwaysLongReleaseJob.php
MIT
public function handle() { $this->longRelease($this->releaseUntil); $this->nextJob(); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AlwaysLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AlwaysLongReleaseJob.php
MIT
public function __construct(public string $key, public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingCacheJob.php
MIT
public function handle() { cache()->put($this->key, $this->value); $this->appendToHaystack(new CacheJob('is_appended', true)); $this->nextJob(); }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingCacheJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingDelayJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingDelayJob.php
MIT
public function handle() { $this->appendToHaystack(new CacheJob('is_appended', true), 120, 'cowboy', 'redis'); $this->nextJob(); }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingDelayJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingDelayJob.php
MIT
public function __construct(public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingNextOrderCheckCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingNextOrderCheckCacheJob.php
MIT
public function handle() { cache()->put('order', array_merge(cache()->get('order', []), [$this->value])); $this->appendToHaystack(new OrderCheckCacheJob($this->value)); $this->nextJob(); }
Execute the job. @return void @throws \Psr\Container\ContainerExceptionInterface @throws \Psr\Container\NotFoundExceptionInterface @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendingNextOrderCheckCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendingNextOrderCheckCacheJob.php
MIT
public function __construct(public string $first, public string $second, public string $third, public bool $collection = false) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendMultipleJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendMultipleJob.php
MIT
public function handle() { $jobs = [ new OrderCheckCacheJob($this->first), new OrderCheckCacheJob($this->second), new OrderCheckCacheJob($this->third), ]; if ($this->collection === true) { $jobs = collect($jobs); } $this->appendToHaystack($jobs); $this->nextJob(); }
Execute the job. @return void @throws \Psr\Container\ContainerExceptionInterface @throws \Psr\Container\NotFoundExceptionInterface @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AppendMultipleJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AppendMultipleJob.php
MIT
public function __construct(public int|CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoAlwaysLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoAlwaysLongReleaseJob.php
MIT
public function handle() { $this->longRelease($this->releaseUntil); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoAlwaysLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoAlwaysLongReleaseJob.php
MIT
public function __construct(public string $key, public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoCacheJob.php
MIT
public function __construct(public CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoLongReleaseJob.php
MIT
public function handle() { $shouldRelease = cache()->get('release') === true; if ($shouldRelease === true) { cache()->set('release', false); $this->longRelease($this->releaseUntil); } else { cache()->set('longReleaseFinished', true); } }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoLongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoLongReleaseJob.php
MIT
public function __construct(public string $key, public string $value, public int|CarbonInterface $pause) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoPauseNextJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoPauseNextJob.php
MIT
public function handle() { cache()->put($this->key, $this->value); $this->pauseHaystack(300); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoPauseNextJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoPauseNextJob.php
MIT
public function retryUntil(): DateTime { return now()->addMinutes(30); }
Determine the time at which the job should timeout.
retryUntil
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoRetryUntilJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoRetryUntilJob.php
MIT
public function __construct(public int|CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/AutoRetryUntilJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/AutoRetryUntilJob.php
MIT
public function __construct(public string $key, public string|bool $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CacheJob.php
MIT
public function handle() { cache()->put($this->key, $this->value); $this->nextBale(); // Alias of next job }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CacheJob.php
MIT
public function __construct(public string $key) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CountrySingerJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CountrySingerJob.php
MIT
public function handle() { $model = $this->getHaystackModel($this->key); cache()->put('singer', $model->name); $this->nextJob(); }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CountrySingerJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CountrySingerJob.php
MIT
public function __construct(public string $option) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CustomOptionJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CustomOptionJob.php
MIT
public function handle() { cache()->put('option', $this->getHaystackOption($this->option)); cache()->put('allOptions', $this->getHaystackOptions()); $this->nextBale(); // Alias of next job }
Execute the job. @return void @throws StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/CustomOptionJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/CustomOptionJob.php
MIT
public function __construct(public int $tries = 1) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ExceptionJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ExceptionJob.php
MIT
public function handle() { throw new Exception('Oh yee-naw! Something bad happened.'); }
Execute the job. @return void @throws Exception
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ExceptionJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ExceptionJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ExcitedJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ExcitedJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/FailJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/FailJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/GetAllAndCacheDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/GetAllAndCacheDataJob.php
MIT
public function handle() { $data = $this->allHaystackData(); cache()->set('all', $data); $this->nextBale(); // Alias of next job }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/GetAllAndCacheDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/GetAllAndCacheDataJob.php
MIT
public function __construct(public string $key) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/GetAndCacheDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/GetAndCacheDataJob.php
MIT
public function handle() { $data = $this->getHaystackData($this->key); cache()->set($this->key, $data); $this->nextBale(); // Alias of next job }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/GetAndCacheDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/GetAndCacheDataJob.php
MIT
public function __construct(public int|CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/LongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/LongReleaseJob.php
MIT
public function handle() { $shouldRelease = cache()->get('release') === true; if ($shouldRelease === true) { cache()->set('release', false); $this->longRelease($this->releaseUntil); } else { cache()->set('longReleaseFinished', true); } $this->nextJob(); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/LongReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/LongReleaseJob.php
MIT
public function __construct(public int $tries = 1) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ManuallyFailedJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ManuallyFailedJob.php
MIT
public function handle() { $this->fail(); }
Execute the job. @return void @throws Exception
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ManuallyFailedJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ManuallyFailedJob.php
MIT
public function __construct(public string $name) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/NameJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/NameJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/NativeFailJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/NativeFailJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/NotStackableJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/NotStackableJob.php
MIT
public function __construct(public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/OrderCheckCacheJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/OrderCheckCacheJob.php
MIT
public function __construct(public string $key, public string|bool $value, public int|CarbonInterface $pause) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/PauseNextJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/PauseNextJob.php
MIT
public function handle() { cache()->put($this->key, $this->value); $this->nextJob($this->pause); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/PauseNextJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/PauseNextJob.php
MIT
public function __construct(public string $first, public string $second, public string $third, public bool $collection = false) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/PrependMultipleJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/PrependMultipleJob.php
MIT
public function handle() { $jobs = [ new OrderCheckCacheJob($this->first), new OrderCheckCacheJob($this->second), new OrderCheckCacheJob($this->third), ]; if ($this->collection === true) { $jobs = collect($jobs); } $this->prependToHaystack($jobs); $this->nextJob(); }
Execute the job. @return void @throws \Psr\Container\ContainerExceptionInterface @throws \Psr\Container\NotFoundExceptionInterface @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/PrependMultipleJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/PrependMultipleJob.php
MIT
public function __construct() { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/ReleaseJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/ReleaseJob.php
MIT
public function retryUntil(): DateTime { return now()->addMinutes(30); }
Determine the time at which the job should timeout.
retryUntil
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/RetryUntilJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/RetryUntilJob.php
MIT
public function __construct(public int|CarbonInterface $releaseUntil) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/RetryUntilJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/RetryUntilJob.php
MIT
public function handle() { $this->longRelease($this->releaseUntil); $this->nextJob(); }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/RetryUntilJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/RetryUntilJob.php
MIT
public function __construct(public string $key, public string $value) { // }
Create a new job instance. @return void
__construct
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/SetDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/SetDataJob.php
MIT
public function handle() { $this->setHaystackData($this->key, $this->value); $this->nextBale(); // Alias of next job }
Execute the job. @return void @throws \Sammyjo20\LaravelHaystack\Tests\Exceptions\StackableException
handle
php
Sammyjo20/laravel-haystack
tests/Fixtures/Jobs/SetDataJob.php
https://github.com/Sammyjo20/laravel-haystack/blob/master/tests/Fixtures/Jobs/SetDataJob.php
MIT