APIEventsController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 63
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 4 1
A show() 0 4 1
A store() 0 4 1
A update() 0 5 1
A destroy() 0 5 1
1
<?php
2
3
namespace Acacha\Events\Http\Controllers;
4
5
use Acacha\Events\Http\Requests\DestroyEvent;
6
use Acacha\Events\Http\Requests\ListEvents;
7
use Acacha\Events\Http\Requests\ShowEvent;
8
use Acacha\Events\Http\Requests\StoreEvent;
9
use Acacha\Events\Http\Requests\UpdateEvent;
10
use Acacha\Events\Models\Event;
11
12
/**
13
 * Class APIEventsController.
14
 * 
15
 * @package App\Http\Controllers
16
 */
17
class APIEventsController extends Controller
18
{
19
    /**
20
     * Show list of events.
21
     *
22
     * @param ListEvents $request
23
     * @return \Illuminate\Database\Eloquent\Collection|static[]
24
     */
25
    public function index(ListEvents $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        return Event::all();
28
    }
29
30
    /**
31
     * Show an event.
32
     *
33
     * @param ShowEvent $request
34
     * @param Event $event
35
     * @return Event
36
     */
37
    public function show(ShowEvent $request, Event $event)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        return $event;
40
    }
41
42
    /**
43
     * Store an event.
44
     *
45
     * @param StoreEvent $request
46
     * @return mixed
47
     */
48
    public function store(StoreEvent $request)
49
    {
50
        return Event::create($request->only(['name','user_id','description']));
0 ignored issues
show
Bug introduced by
The method create() does not exist on Acacha\Events\Models\Event. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
51
    }
52
53
    /**
54
     * Update an event.
55
     *
56
     * @param UpdateEvent $request
57
     * @param Event $event
58
     * @return Event
59
     */
60
    public function update(UpdateEvent $request , Event $event)
61
    {
62
        $event->update($request->only(['name','description']));
63
        return $event;
64
    }
65
66
    /**
67
     * Destroy an event.
68
     *
69
     * @param DestroyEvent $request
70
     * @param Event $event
71
     * @return Event
72
     */
73
    public function destroy(DestroyEvent $request, Event $event)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
74
    {
75
        $event->delete();
76
        return $event;
77
    }
78
79
}
80