Get the source string for the slug.

@param mixed $from

@return string
420364
protected function getSlugSource($from): string
    {
        if (is_null($from)) {
            return $this->model->__toString();
        }

        $sourceStrings = array_map(function($key) {
            $value = data_get($this->model, $key);
            if (is_bool($value)) {
                $value = (int) $value;
            }

            return $value;
        }, (array) $from);

        return implode($sourceStrings, ' ');
    }
51078
public function from($from, $name = null)
    {
        $this->from = ($name !== null) ? (ucwords($name) . " <{$from}>") : $from;

        return $this;
    }
683179
public function getSlugForTitle($title)
    {
        $slug = Str::slug($title);
        $latestSlug = $this->model->whereRaw("slug RLIKE '^{$slug}(-[0-9]*)?$'")->latest()->value('slug');

        if ($latestSlug) {
            $pieces = explode('-', $latestSlug);
            $number = end($pieces);

            return $slug.'-'.($number + 1);
        }

        return $slug;
    }
360423
public function computeRelativePathBetween($from, $to)
    {
        $from = $this->explodePath($from);
        $to = $this->explodePath($to);

        // Skip the common path prefix
        foreach ($from as $key => $component) {
            if (isset($to[$key]) && $to[$key] === $component) {
                unset($from[$key], $to[$key]);
            }
        }

        // Compute new realpath
        $relativePath = implode('/', $to);
        $relativePath = str_repeat('../', count($from) - 1).$relativePath;
        $relativePath = trim($relativePath, '/');

        return $relativePath;
    }
94151
protected static function _getValue($from, $subject) {
		$cached = static::_getCache($from, $subject);
		if (isset($cached)) {
			return $cached;
		}

		$value = null;
		switch (true) {
			case is_array($subject):
				$value = Set::get($subject, $from);
				break;
			case is_object($subject) && is_string($from):
				if (isset($subject->$from)) {
					$value = $subject->$from;
				} elseif (method_exists($subject, $from)) {
					$value = $subject->{$from}();
				} else {
					throw new InvalidArgumentException('Method or attribute does not exists: ' . $from);
				}
				break;
			case is_numeric($subject) || is_string($subject):
				$value = $subject;
				break;
			case is_callable($from):
				$value = call_user_func($from, $subject);
				break;
			default:
				throw new InvalidArgumentException('Wrong type combination: subject -> ' . gettype($subject) . ', from -> ' . gettype($from));
		}

		if (is_array($value)) {
			$value = count($value);
		}
		static::_setCache($from, $subject, $value);
		return $value;
	}
18059
public static function getConnectionString($key)
    {
        Validate::isString($key, 'key');

        self::_init();
        $value = null;

        foreach (self::$_sources as $source) {
            $value = call_user_func_array($source, [$key]);

            if (!empty($value)) {
                break;
            }
        }

        return $value;
    }
336297
public static function grab($slug)
    {
        /*
         * Comment out prior to 0.2 launch. Will cause massive amount
         * of Database queries. Only for adding new settings while
         * in development and testing.
         */
        //       Cache::flush();

        $setting = Cache::remember('ticketit::settings.'.$slug, 60, function () use ($slug) {
            $settings = Cache::remember('ticketit::settings', 60, function () {
                return Table::all();
            });

            $setting = $settings->where('slug', $slug)->first();

            if ($setting->lang) {
                return trans($setting->lang);
            }

            if (self::is_serialized($setting->value)) {
                $setting = unserialize($setting->value);
            } else {
                $setting = $setting->value;
            }

            return $setting;
        });

        return $setting;
    }
972449
public static function copy(string $from, string $to) {
		ref\file::path($from, true);
		if (! $from) {
			return false;
		}

		ref\file::path($to, false);
		if (! $to || ($from === $to)) {
			return false;
		}

		// Recurse directories.
		if (@\is_dir($from)) {
			ref\file::trailingslash($from);
			ref\file::trailingslash($to);

			if (! @\is_dir($to)) {
				$dir_chmod = (@\fileperms($from) & 0777 | 0755);
				if (! static::mkdir($to, $dir_chmod)) {
					return false;
				}
			}

			// Copy all files and directories within.
			if ($handle = @\opendir($from)) {
				while (false !== ($file = @\readdir($handle))) {
					// Ignore dots.
					if (('.' === $file) || ('..' === $file)) {
						continue;
					}

					// Recurse.
					static::copy("{$from}{$file}", "{$to}{$file}");
				}
				\closedir($handle);
			}

			return true;
		}
		// Let PHP handle it.
		elseif (@\is_file($from)) {
			$dir_from = \dirname($from);
			$dir_to = \dirname($to);

			// Make the TO directory if it doesn't exist.
			if (! @\is_dir($dir_to)) {
				$dir_chmod = (@\fileperms($dir_from) & 0777 | 0755);
				if (! static::mkdir($dir_to, $dir_chmod)) {
					return false;
				}
			}

			// Copy the file.
			if (! @\copy($from, $to)) {
				return false;
			}
			$file_chmod = (@\fileperms($from) & 0777 | 0644);
			@\chmod($to, $file_chmod);

			return true;
		}

		return false;
	}
280610
private function fromCheck($from, $quotes = null)
    {
        if ($from == "") {
            $from = $this->from;
        }
        if ($quotes === null) {
            $quotes = $this->quotes;
        }
        if ($quotes) {
            $from = "`" . $from . "`";
        }

        return $from;
    }
1068792
private function copyDir($from, $to)
    {
        mkdir($to, 0777, true);
        
        $items = new FilesystemIterator($from);

        foreach ($items as $item)
        {
            $pattern = preg_quote($from, "/");
            $Key = preg_replace("/^{$pattern}/", "", $item);

            $subFrom = strval($item);
            $subTo   = $to.$Key;
            
            if (filetype($item) == 'dir')
            {
                $this->copyDir($subFrom, $subTo);
            } else {
                $this->copyFile($subFrom, $subTo);
            }
        }

        return true;
    }
842700
public function getSlug() : ?string 
    {
        if ( ! $this->hasSlug()) {
            $this->setSlug($this->getDefaultSlug());
        }
        return $this->slug;
    }
986973
public function from($from)
    {
        $this->from = is_object($from) ? $from->getKey() : $from;

        return $this;
    }
177926
public function rename($from, $to) {
		return $this->getState()->rename($this->buildUrl($from), $this->buildUrl($to));
	}
237954
private function getUrl($string, $from, $to, $key)
    {
        return sprintf(
            'https://www.googleapis.com/language/translate/v2?key=%s&source=%s&target=%s&q=%s',
            $key,
            $from,
            $to,
            urlencode($string)
        );
    }
126764
public static function getISOBySlug($slug)
    {
        $data = collect(self::ISOlist());
        return $data->where('slug', $slug)->first();
    }
620
public function getPreviousVersion($from)
    {
        $lastTimestamp = 0;
        foreach (array_keys($this->versions) as $timestamp) {
            if ($timestamp == $from) {
                return $lastTimestamp;
            }
            $lastTimestamp = $timestamp;
        }

        return 0;
    }
196854
public function diff($from, $to): string
    {
        $diff = $this->differ->diff($from, $to);

        if (preg_match(
            '/(?:[^\n]*(\n)){' . self::DIFF_MAX_LINES . '}/',
            $diff,
            $matches,
            PREG_OFFSET_CAPTURE
        )) {
            $diff = substr($diff, 0, $matches[1][1]);
        }

        return $diff;
    }