HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/ipsremont-demo/app/Models/Schema.php
<?php


namespace App\Models;


use App\Traits\My;
use App\Traits\Sortable;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @property int $id
 * @property string $external_id
 * @property string $name
 * @property string $photo
 * @property string $sequence_number
 * @property string $deleted_at
 * @property string $created_at
 * @property string $updated_at
 */
class Schema extends BaseModel
{

    use SoftDeletes, Sortable, My;

    protected $table = 'schema';

    public static string $imagePath = '/demo-images/';

    protected $fillable = [
        'external_id',
        'name',
        'photo',
        'sequence_number',
    ];

    protected static $labels = [
        'external_id' => 'schema.external_id',
        'name' => 'schema.name',
        'photo' => 'schema.photo',
        'sequence_number' => 'schema.sequence_number',
    ];

    public static function columns()
    {
        return [
            "fields" => [
                [
                    "displayName" => 'grid.external_id',
                    "field" => "external_id",
                    "sort" => true,
                    "sortType" => 'asc',
                    'class' => 'w-100px',
                ],
                [
                    "displayName" => 'grid.name',
                    "field" => "name",
                    "sort" => true,
                    "sortType" => 'asc',
                    'class' => 'text-left',
                ],
                [
                    "displayName" => 'grid.photo',
                    "field" => "photo",
                    "sort" => true,
                    "sortType" => 'asc',
                    'class' => 'text-left',
                ],
                [
                    "displayName" => 'grid.sequence_number',
                    "field" => "sequence_number",
                    "sort" => true,
                    "sortType" => 'asc',
                    'class' => 'text-left',
                ],
                [
                    "displayName" => '',
                    "field" => 'action',
                    "sort" => false,
                    'class' => 'w-100px',
                ],
            ],
            "sortDefault" => [
                [
                    "field" => 'sequence_number',
                    "sort" => 'asc',
                ],
            ],
        ];
    }

    public function getParts()
    {
        return Part::query()->select('parts.*')
            ->join('schema_parts', 'external_id', '=', 'part_external_id')
            ->where('schema_external_id', $this->external_id)
            ->get();
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getImage(): string
    {
        return empty($this->photo) ? '' : self::$imagePath . $this->photo;
    }

}