EventPaymentChart   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A mount() 0 4 2
A initializeEventPaymentChart() 0 4 1
1
<?php
2
3
namespace Adminetic\Website\Http\Livewire\Admin\Charts\Event;
4
5
use Adminetic\Website\Models\Admin\Payment;
6
use Adminetic\Website\Services\Statistic;
7
use Livewire\Component;
8
9
class EventPaymentChart extends Component
10
{
11
    public $event;
12
    public $payments;
13
    public $chart = 1; // 1 = Area | 2 = Bar
14
    public $per = 1; // 1 = Day | 2 = Month
15
16
    protected $listeners = ['initialize_event_payment_chart' => 'initializeEventPaymentChart'];
17
18
    public function mount($event = null)
19
    {
20
        $this->event = $event;
21
        $this->payments = ! is_null($event) ? $event->payments : Payment::orderBy('position')->get();
22
    }
23
24
    public function initializeEventPaymentChart()
25
    {
26
        $payments = $this->payments;
27
        $this->dispatchBrowserEvent('initializeEventPaymentChart', (new Statistic)->perDayPaymentTotal($payments));
28
    }
29
30
    public function render()
31
    {
32
        return view('website::livewire.admin.charts.event.event-payment-chart');
33
    }
34
}
35