Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace PowerComponents\LivewirePowerGrid\Components\Filters\Builders; use Illum..
Decoded Output download
<?php
namespace PowerComponents\LivewirePowerGrid\Components\Filters\Builders;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\{Carbon, Collection};
class DatePicker extends BuilderBase
{
public function builder(EloquentBuilder|QueryBuilder $builder, string $field, int|array|string|null $values): void
{
if (gettype($values) !== 'array') {
return;
}
if (!isset($values['start']) && !isset($values['end'])) {
return;
}
/** @var array $values */
[$startDate, $endDate] = [
0 => Carbon::parse($values['start'])->format('Y-m-d'),
1 => Carbon::parse($values['end'])->format('Y-m-d'),
];
if (data_get($this->filterBase, 'builder')) {
/** @var \Closure $closure */
$closure = data_get($this->filterBase, 'builder');
$closure($builder, $values);
return;
}
$builder->whereBetween($field, [$startDate, $endDate]);
}
public function collection(Collection $collection, string $field, int|array|string|null $values): Collection
{
if (!isset($values['start']) && !isset($values['end'])) {
return $collection;
}
/** @var array $values */
[$startDate, $endDate] = [
0 => Carbon::parse($values[0])->format('Y-m-d'),
1 => Carbon::parse($values[1])->format('Y-m-d'),
];
if (data_get($this->filterBase, 'collection')) {
/** @var \Closure $closure */
$closure = data_get($this->filterBase, 'collection');
return $closure($collection, $values);
}
return $collection->whereBetween($field, [$startDate, $endDate]);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace PowerComponents\LivewirePowerGrid\Components\Filters\Builders;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\{Carbon, Collection};
class DatePicker extends BuilderBase
{
public function builder(EloquentBuilder|QueryBuilder $builder, string $field, int|array|string|null $values): void
{
if (gettype($values) !== 'array') {
return;
}
if (!isset($values['start']) && !isset($values['end'])) {
return;
}
/** @var array $values */
[$startDate, $endDate] = [
0 => Carbon::parse($values['start'])->format('Y-m-d'),
1 => Carbon::parse($values['end'])->format('Y-m-d'),
];
if (data_get($this->filterBase, 'builder')) {
/** @var \Closure $closure */
$closure = data_get($this->filterBase, 'builder');
$closure($builder, $values);
return;
}
$builder->whereBetween($field, [$startDate, $endDate]);
}
public function collection(Collection $collection, string $field, int|array|string|null $values): Collection
{
if (!isset($values['start']) && !isset($values['end'])) {
return $collection;
}
/** @var array $values */
[$startDate, $endDate] = [
0 => Carbon::parse($values[0])->format('Y-m-d'),
1 => Carbon::parse($values[1])->format('Y-m-d'),
];
if (data_get($this->filterBase, 'collection')) {
/** @var \Closure $closure */
$closure = data_get($this->filterBase, 'collection');
return $closure($collection, $values);
}
return $collection->whereBetween($field, [$startDate, $endDate]);
}
}
Function Calls
None |
Stats
MD5 | 1664311536d8cd3327641d19c1b15d05 |
Eval Count | 0 |
Decode Time | 84 ms |