fixed export file name
This commit is contained in:
40
app/Providers/Macro.php
Normal file
40
app/Providers/Macro.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Macro extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Str::macro('filename', function ($string, $separator = '-') {
|
||||
// Replace @ with the word 'at'
|
||||
$string = str_replace('@', $separator.'at'.$separator, $string);
|
||||
|
||||
// Remove all characters that are not the separator, letters, numbers, or whitespace.
|
||||
$string = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', $string);
|
||||
|
||||
// Remove multiple whitespaces
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
|
||||
return $string;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user