TasksRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A mark() 0 4 1
A __construct() 0 3 1
A allTask() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: me
5
 * Date: 18.06.17
6
 * Time: 00:03
7
 */
8
9
namespace TaskManager\Repository;
10
11
12
use Carbon\Carbon;
13
use TaskManager\Tasks;
14
15
class TasksRepository
16
{
17
    protected $task;
18
    /**
19
     * TasksRepository constructor.
20
     * @param Tasks $task
21
     */
22
    function __construct(Tasks $task)
23
    {
24
        $this->task = $task;
25
    }
26
    /**
27
     * @return mixed
28
     */
29
    public function allTask(){
30
        return $this->task->where('user_id', auth()->id())->orderBy('created_at', 'desc')->get()->groupBy(function($data){
0 ignored issues
show
Bug introduced by
The method id() 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

30
        return $this->task->where('user_id', auth()->/** @scrutinizer ignore-call */ id())->orderBy('created_at', 'desc')->get()->groupBy(function($data){

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...
31
            return Carbon::parse($data->created_at)->format('d.m.Y');
32
        });
33
}
34
    /**
35
     * @param Tasks $c_task
36
     */
37
    public function mark(Tasks $c_task){
38
        $c_task =  $this->task->where('id', $c_task->id)->first();
39
        $c_task->complete=true;
40
        $c_task->save();
41
    }
42
}