Issues (41)

app/Http/Controllers/TasksController.php (6 issues)

1
<?php
2
3
namespace TaskManager\Http\Controllers;
4
5
use TaskManager\Http\Requests\TaskRequest;
6
use TaskManager\Repository\TasksRepository;
7
use TaskManager\Tasks;
8
9
class TasksController extends Controller
10
{
11
    protected $task;
12
    function __construct( TasksRepository $task)
13
    {
14
        $this->task = $task;
15
        $this->middleware('auth')->except('index');
16
    }
17
18
    /**
19
     * Display a listing of the resource.
20
     * @return \Illuminate\Http\Response
21
     */
22
    public function index()
23
    {
24
            if (auth()->guest()) {
0 ignored issues
show
The method guest() does not exist on Illuminate\Contracts\Auth\Factory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
            if (auth()->/** @scrutinizer ignore-call */ guest()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
                return view('home');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('home') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
26
            } else {
27
                $archives = $this->task->allTask();
28
               return view('tasks', compact( 'archives'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('tasks', compact('archives')) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
29
            }
30
    }
31
    /**
32
     * Show the form for creating a new resource.
33
     *
34
     * @return \Illuminate\Http\Response
35
     */
36
    public function create()
37
    {
38
        return view('create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('create') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
39
    }
40
41
    /**
42
     * Store a newly created resource in storage.
43
     * @param TaskRequest $task
44
     * @return \Illuminate\Http\Response
45
     * @internal param Request $request
46
     */
47
    public function store(TaskRequest $task)
0 ignored issues
show
The parameter $task is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

47
    public function store(/** @scrutinizer ignore-unused */ TaskRequest $task)

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

Loading history...
48
    {
49
        Tasks::create(\request(['task', 'complete','user_id']));
50
        return redirect()->home();
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->home() returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
51
    }
52
53
    /**
54
     * Update the specified resource in storage.
55
     *
56
     * @param Tasks $task
57
     * @return void
58
     * @internal param Request $request
59
     * @internal param Tasks $id
60
     * @internal param Tasks $tasks
61
     */
62
    public function update(Tasks $task)
63
    {
64
        $this->task->mark($task);
65
    }
66
    /**
67
     * Remove the specified resource from storage.
68
     *
69
     * @param Tasks $id
70
     * @return void
71
     * @internal param Tasks $tasks
72
     */
73
    public function destroy(Tasks $id)
74
    {
75
        $id->delete();
76
    }
77
78
79
}
80