/** * Remove the table name from a given key. * * @param string $key * @return string */ protected function removeTableFromKey($key) { if (!Str::contains($key, '.')) { return $key; } return last(explode('.', $key)); }
/** * Remove the index.php file from a path. * * @param string $root * @return string */ protected function removeIndex($root) { $i = 'index.php'; return Str::contains($root, $i) ? str_replace('/' . $i, '', $root) : $root; }
/** * Determine if a given string contains a given substring. * * @param string $haystack * @param string|array $needles * @return bool */ function str_contains($haystack, $needles) { return Str::contains($haystack, $needles); }