JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "CrupdateWorkspaceRequest.php"

Full Path: /home/markqprx/iniasli.pro/common-20260222054824/Workspaces/Requests/CrupdateWorkspaceRequest.php
File size: 790 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Common\Workspaces\Requests;

use Auth;
use Common\Core\BaseFormRequest;
use Illuminate\Validation\Rule;

class CrupdateWorkspaceRequest extends BaseFormRequest
{
    public function rules(): array
    {
        $required = $this->getMethod() === 'POST' ? 'required' : '';
        $ignore =
            $this->getMethod() === 'PUT' ? $this->route('workspace')->id : '';
        $userId = $this->route('workspace')
            ? $this->route('workspace')->user_id
            : Auth::id();

        return [
            'name' => [
                $required,
                'string',
                'min:3',
                Rule::unique('workspaces')
                    ->where('owner_id', $userId)
                    ->ignore($ignore),
            ],
        ];
    }
}