export abstract
This commit is contained in:
		@@ -2,23 +2,11 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Sales;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
use App\Models\Banking\Transaction as Model;
 | 
			
		||||
use Jenssegers\Date\Date;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\FromCollection;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\WithHeadings;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\WithMapping;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\WithTitle;
 | 
			
		||||
 | 
			
		||||
class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
 | 
			
		||||
class Revenues extends Export
 | 
			
		||||
{
 | 
			
		||||
    public $ids;
 | 
			
		||||
 | 
			
		||||
    public function __construct($ids = null)
 | 
			
		||||
    {
 | 
			
		||||
        $this->ids = $ids;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function collection()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::type('income')->usingSearchString(request('search'));
 | 
			
		||||
@@ -30,25 +18,7 @@ class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
 | 
			
		||||
        return $model->get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($model): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            Date::parse($model->paid_at)->format('Y-m-d'),
 | 
			
		||||
            $model->amount,
 | 
			
		||||
            $model->currency_code,
 | 
			
		||||
            $model->currency_rate,
 | 
			
		||||
            $model->account_id,
 | 
			
		||||
            $model->document_id,
 | 
			
		||||
            $model->contact_id,
 | 
			
		||||
            $model->category_id,
 | 
			
		||||
            $model->description,
 | 
			
		||||
            $model->payment_method,
 | 
			
		||||
            $model->reference,
 | 
			
		||||
            $model->reconciled,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function headings(): array
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'paid_at',
 | 
			
		||||
@@ -65,9 +35,4 @@ class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
 | 
			
		||||
            'reconciled',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'revenues';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user