APIUserEventsController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 4 1
A store() 0 6 1
1
<?php
2
3
namespace Acacha\Events\Http\Controllers;
4
5
use Acacha\Events\Http\Requests\UserStoreEvent;
6
use Acacha\Events\Models\Event;
7
use Auth;
8
9
/**
10
 * Class APIUserEventsController.
11
 *
12
 * @package App\Http\Controllers
13
 */
14
class APIUserEventsController extends Controller
15
{
16
    /**
17
     * Show list of events.
18
     *
19
     * @return \Illuminate\Database\Eloquent\Collection|static[]
20
     */
21
    public function index()
22
    {
23
        return Auth::user()->events;
24
    }
25
26
    /**
27
     * Store event for logged user.
28
     *
29
     * @return \Illuminate\Database\Eloquent\Collection|static[]
30
     */
31
    public function store(UserStoreEvent $request)
32
    {
33
        $event = 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...
34
        Auth::user()->events()->save($event);
35
        return $event;
36
    }
37
38
}
39