fixed export file name
This commit is contained in:
parent
3dbb2b33e6
commit
2c7b15b331
@ -195,7 +195,7 @@ abstract class Report
|
||||
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export($this->views['content'], $this), $this->model->name . '.xlsx');
|
||||
return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx');
|
||||
}
|
||||
|
||||
public function setYear()
|
||||
|
@ -73,6 +73,6 @@ class Bills extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.bills', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.bills', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,6 @@ class Payments extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.payments', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.payments', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,6 @@ class Vendors extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.vendors', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.vendors', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,6 @@ class Customers extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.customers', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.customers', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,6 @@ class Invoices extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.invoices', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.invoices', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,6 @@ class Revenues extends BulkAction
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), trans_choice('general.revenues', 2) . '.xlsx');
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.revenues', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,6 @@ class Transactions extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.transactions', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.transactions', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ class Items extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.items', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.items', 2)) . '.xlsx');
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
|
@ -268,7 +268,7 @@ class Bills extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.bills', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.bills', 2)) . '.xlsx');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,6 +228,6 @@ class Payments extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.payments', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.payments', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ class Vendors extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.vendors', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.vendors', 2)) . '.xlsx');
|
||||
}
|
||||
|
||||
public function currency(Contact $vendor)
|
||||
|
@ -283,7 +283,7 @@ class Customers extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.customers', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.customers', 2)) . '.xlsx');
|
||||
}
|
||||
|
||||
public function currency(Contact $customer)
|
||||
|
@ -274,7 +274,7 @@ class Invoices extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.invoices', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.invoices', 2)) . '.xlsx');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,6 +228,6 @@ class Revenues extends Controller
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return \Excel::download(new Export(), trans_choice('general.revenues', 2) . '.xlsx');
|
||||
return \Excel::download(new Export(), \Str::filename(trans_choice('general.revenues', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
||||
|
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()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -174,6 +174,7 @@ return [
|
||||
// App\Providers\Broadcast::class,
|
||||
App\Providers\Event::class,
|
||||
App\Providers\Form::class,
|
||||
App\Providers\Macro::class,
|
||||
App\Providers\Observer::class,
|
||||
App\Providers\Route::class,
|
||||
App\Providers\Validation::class,
|
||||
|
Loading…
x
Reference in New Issue
Block a user