user()->can('create', Project::class); } public function rules() { $rules = []; $rules['name'] = 'required'; $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id; return $rules; } protected function prepareForValidation() { $input = $this->decodePrimaryKeys($this->all()); $this->replace($input); } public function getClient($client_id) { return Client::find($client_id); } }