Completed
Push — master ( d4ee0c...92c593 )
by Glenn
03:40
created

CallbackController::destroy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Callback;
6
use Illuminate\Http\Request;
7
8
use App\Http\Requests;
9
10
/**
11
 * Class CallbackController
12
 * @package App\Http\Controllers
13
 */
14
class CallbackController extends Controller
15
{
16
	    public function __construct()
17
    {
18
        $this->middleware('auth');
19
        $this->middleware('lang');
20
    }
21
    
22
    /**
23
     * Display all the callbacks.
24
     *
25
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
26
     */
27
    public function index()
28
    {
29
        $data['query'] = Callback::all();
0 ignored issues
show
Coding Style Comprehensibility introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
30
    	return view('callbacks/list', $data);
31
    }
32
33
34
    /**
35
     * Create a new callback.
36
     *
37
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
38
     */
39
    public function create()
40
    {
41
        return view('callbacks.create');
42
    }
43
44
    /**
45
     * Store a callback request.
46
     *
47
     * @return \Illuminate\Http\RedirectResponse
48
     */
49
    public function store()
50
    {
51
        return redirect()->back(302);
52
    }
53
54
    /**
55
     * Show update form for a callback.
56
     * 
57
     * @param  int $id the callback id in the database.
58
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
59
     */
60
    public function edit($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id 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...
61
    {
62
    	return view('callbacks/details');
63
    }
64
65
    /**
66
     * Destroy a callback out off the system.
67
     *
68
     * @param  int $id The callback id in the database.
69
     * @return \Illuminate\Http\RedirectResponse
70
     */
71
    public function destroy($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id 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...
72
    {
73
        return redirect()->back(302);
74
    }
75
76
}
77