Obtenez le nom de base sans extension Laravel

use Illuminate\Support\Str;

$string = Str::of('/foo/bar/baz.jpg')->basename('.jpg');

// 'baz'
Zealous Zebra