/** * Add a single dynamic where clause statement to the query. * * @param string $segment * @param string $connector * @param array $parameters * @param int $index * @return void */ protected function addDynamic($segment, $connector, $parameters, $index) { $bool = strtolower($connector); $this->where(Str::snake($segment), '=', $parameters[$index], $bool); }
/** * Handle dynamic calls to class methods. * * @param string $method * @param array $parameters * @return mixed * * @throws \BadMethodCallException */ public function __call($method, $parameters) { $rule = Str::snake(substr($method, 8)); if (isset($this->extensions[$rule])) { return $this->callExtension($rule, $parameters); } throw new \BadMethodCallException("Method [{$method}] does not exist."); }
/** * Dynamically bind flash data in the session. * * @param string $method * @param array $parameters * @return void * * @throws \BadMethodCallException */ public function __call($method, $parameters) { if (str_starts_with($method, 'with')) { return $this->with(Str::snake(substr($method, 4)), $parameters[0]); } throw new \BadMethodCallException("Method [{$method}] does not exist on Redirect."); }
/** * Get the model's relationships in array form. * * @return array */ public function relationsToArray() { $attributes = array(); foreach ($this->getArrayableRelations() as $key => $value) { if (in_array($key, $this->hidden)) { continue; } if ($value instanceof ArrayableInterface) { $relation = $value->toArray(); } else { if (is_null($value)) { $relation = $value; } } if (static::$snakeAttributes) { $key = Str::snake($key); } if (isset($relation) || is_null($value)) { $attributes[$key] = $relation; } unset($relation); } return $attributes; }