Skip to content
Discussion options

You must be logged in to vote

that code is terrible, Media::where('name', $fileName)->get(), better Media::where('name', $fileName)->count()
you misunderstood how it works originalFileName
also you must use markdown correctly, example:

public function responsiveFileName(string $fileName): string
{
    return pathinfo($fileName, PATHINFO_FILENAME);
}

Here is your mistake

public function originalFileName(string $fileName): string
{
$extLength = strlen(pathinfo($fileName, PATHINFO_EXTENSION));
$baseName = substr($fileName, 0, strlen($fileName) - ($extLength ? $extLength + 1 : 0));
return $baseName;
}

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@PaolaRuby
Comment options

@EgoRoman
Comment options

@PaolaRuby
Comment options

@EgoRoman
Comment options

@PaolaRuby
Comment options

Answer selected by EgoRoman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants