Lukasss93/laravel-larex

View on GitHub
src/helpers.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

use Illuminate\Support\Str;

function csv_path($relative = false): string
{
    $path = config('larex.csv.path');

    if ($relative) {
        return ltrim(str_replace(base_path(), '', $path), '/\\');
    }

    return $path;
}

function lang_rpath(string $value): string
{
    $value = ltrim($value, '\\/');

    return Str::of(lang_path($value))
        ->replace(base_path(), '')
        ->replace('lang\\', 'lang/')
        ->ltrim('\\/');
}