code stringlengths 31 707k | docstring stringlengths 23 14.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 getJobs(): Collection
{
return $this->jobs;
} | Get all the jobs in the builder. | getJobs | php | Sammyjo20/laravel-haystack | src/Builders/HaystackBuilder.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Builders/HaystackBuilder.php | MIT |
public function getGlobalDelayInSeconds(): int
{
return $this->globalDelayInSeconds;
} | Get the time for the "withDelay". | getGlobalDelayInSeconds | php | Sammyjo20/laravel-haystack | src/Builders/HaystackBuilder.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Builders/HaystackBuilder.php | MIT |
public function getMiddleware(): MiddlewareCollection
{
return $this->middleware;
} | Get the closure for the global middleware. | getMiddleware | php | Sammyjo20/laravel-haystack | src/Builders/HaystackBuilder.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Builders/HaystackBuilder.php | MIT |
public function beforeSave(Closure $closure): static
{
$this->beforeSave = $closure;
return $this;
} | Specify a closure to run before saving the Haystack
@return $this | beforeSave | php | Sammyjo20/laravel-haystack | src/Builders/HaystackBuilder.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Builders/HaystackBuilder.php | MIT |
public function setOption(string $option, mixed $value): static
{
$this->options->$option = $value;
return $this;
} | Set an option on the Haystack Options.
@return $this | setOption | php | Sammyjo20/laravel-haystack | src/Builders/HaystackBuilder.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Builders/HaystackBuilder.php | MIT |
public function set($model, string $key, $value, array $attributes)
{
if (blank($value)) {
return null;
}
if (! $value instanceof CallbackCollection) {
throw new InvalidArgumentException(sprintf('Value provided must be an instance of %s.', CallbackCollection::class))... | Serialize a job.
@return mixed|string|null | set | php | Sammyjo20/laravel-haystack | src/Casts/CallbackCollectionCast.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Casts/CallbackCollectionCast.php | MIT |
public function set($model, string $key, $value, array $attributes): ?string
{
if (blank($value)) {
return null;
}
if ($value instanceof Closure === false && is_callable($value) === false) {
throw new InvalidArgumentException('Value provided must be a closure or an i... | Serialize a closure.
@return mixed|string|null
@throws \Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException | set | php | Sammyjo20/laravel-haystack | src/Casts/SerializeClosure.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Casts/SerializeClosure.php | MIT |
public function set($model, string $key, $value, array $attributes)
{
if (blank($value)) {
return null;
}
if (! $value instanceof Model) {
throw new InvalidArgumentException('The provided value must be a model.');
}
return SerializationHelper::serial... | Serialize a model.
@return mixed|string|null | set | php | Sammyjo20/laravel-haystack | src/Casts/SerializedModel.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Casts/SerializedModel.php | MIT |
public function getNextJobRow(): ?HaystackBale
{
return $this->bales()->first();
} | Get the next job row in the Haystack. | getNextJobRow | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function getNextJob(): ?NextJob
{
$jobRow = $this->getNextJobRow();
if (! $jobRow instanceof HaystackBale) {
return null;
}
// We'll retrieve the configured job which will have
// the delay, queue and connection all set up.
$job = $jobRow->config... | Get the next job from the Haystack. | getNextJob | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function dispatchNextJob(?StackableJob $currentJob = null, int|CarbonInterface|null $delayInSecondsOrCarbon = null): void
{
// If the resume_at has been set, and the date is in the future, we're not allowed to process
// the next job, so we stop.
if ($this->resume_at instanceof Carbo... | Dispatch the next job.
@throws PhpVersionNotSupportedException | dispatchNextJob | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function addJobs(StackableJob|Collection|array $jobs, int $delayInSeconds = 0, ?string $queue = null, ?string $connection = null, bool $prepend = false): void
{
if ($jobs instanceof StackableJob) {
$jobs = [$jobs];
}
if ($jobs instanceof Collection) {
$jobs = ... | Add new jobs to the haystack. | addJobs | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function addPendingJobs(array $pendingJobs): void
{
$pendingJobRows = collect($pendingJobs)
->filter(fn ($pendingJob) => $pendingJob instanceof PendingHaystackBale)
->map(fn (PendingHaystackBale $pendingJob) => $pendingJob->toDatabaseRow($this))
->all();
i... | Add pending jobs to the haystack. | addPendingJobs | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
protected function invokeCallbacks(?array $closures, ?Collection $data = null): void
{
collect($closures)->each(function (SerializableClosure $closure) use ($data) {
$closure($data);
});
} | Execute the closures.
@param array<SerializableClosure> $closures
@throws PhpVersionNotSupportedException | invokeCallbacks | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function setData(string $key, mixed $value, ?string $cast = null): self
{
DataValidator::validateCast($value, $cast);
$this->data()->updateOrCreate(['key' => $key], [
'cast' => $cast,
'value' => $value,
]);
return $this;
} | Store data on the Haystack.
@return ManagesBales|\Sammyjo20\LaravelHaystack\Models\Haystack | setData | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function getData(string $key, mixed $default = null): mixed
{
$data = $this->data()->where('key', $key)->first();
return $data instanceof HaystackData ? $data->value : $default;
} | Retrieve data by a key from the Haystack. | getData | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function setModel(Model $model, ?string $key = null): static
{
$key = DataHelper::getModelKey($model, $key);
if ($this->data()->where('key', $key)->exists()) {
throw new HaystackModelExists($key);
}
return $this->setData($key, $model, SerializedModel::class);
... | Set a model on a Haystack
@return $this
@throws HaystackModelExists | setModel | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function allData(bool $includeModels = false): Collection
{
$data = $this->data()
->when($includeModels === false, fn ($query) => $query->where('key', 'NOT LIKE', 'model:%'))
->orderBy('id')->get();
return $data->mapWithKeys(function ($value, $key) {
retur... | Retrieve all the data from the Haystack. | allData | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
protected function conditionallyGetAllData(): ?Collection
{
$returnAllData = config('haystack.return_all_haystack_data_when_finished', false);
return $this->options->returnDataOnFinish === true && $returnAllData === true ? $this->allData() : null;
} | Conditionally retrieve all the data from the Haystack depending on
if we are able to return the data. | conditionallyGetAllData | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function setBaleRetryUntil(StackableJob $job, int $retryUntil): void
{
HaystackBale::query()->whereKey($job->getHaystackBaleId())->update(['retry_until' => $retryUntil]);
} | Set the retry-until on the job. | setBaleRetryUntil | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function getCallbacks(): CallbackCollection
{
return $this->callbacks ?? new CallbackCollection;
} | Get the callbacks on the Haystack. | getCallbacks | php | Sammyjo20/laravel-haystack | src/Concerns/ManagesBales.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/ManagesBales.php | MIT |
public function setHaystack(Haystack $haystack): static
{
$this->haystack = $haystack;
return $this;
} | Set the Haystack onto the job.
@return $this | setHaystack | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
public function nextJob(int|CarbonInterface|null $delayInSecondsOrCarbon = null): static
{
if (config('haystack.process_automatically', false) === true) {
throw new StackableException('The "nextJob" method is unavailable when "haystack.process_automatically" is enabled.');
}
$th... | Dispatch the next job in the Haystack.
@return $this
@throws StackableException | nextJob | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
public function nextBale(int|CarbonInterface|null $delayInSecondsOrCarbon = null): static
{
return $this->nextJob($delayInSecondsOrCarbon);
} | Dispatch the next bale in the haystack. Yee-haw!
@return $this
@throws StackableException | nextBale | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
public function longRelease(int|CarbonInterface $delayInSecondsOrCarbon): static
{
$resumeAt = CarbonHelper::createFromSecondsOrCarbon($delayInSecondsOrCarbon);
$this->haystack->pause($resumeAt);
return $this;
} | Release the job for haystack to process later.
@return $this | longRelease | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
public function failHaystack(): static
{
$this->haystack->finish(FinishStatus::Failure);
return $this;
} | Fail the job stack.
@return $this | failHaystack | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
public function appendToHaystack(StackableJob|Collection|array $jobs, int $delayInSeconds = 0, ?string $queue = null, ?string $connection = null): static
{
$this->haystack->addJobs($jobs, $delayInSeconds, $queue, $connection, false);
return $this;
} | Append jobs to the haystack.
@return $this | appendToHaystack | php | Sammyjo20/laravel-haystack | src/Concerns/Stackable.php | https://github.com/Sammyjo20/laravel-haystack/blob/master/src/Concerns/Stackable.php | MIT |
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 ... | 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 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) ... | 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 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->queu... | 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 {
... | 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... | 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 |
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 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 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 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 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 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 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 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.