Completed
Push — master ( 20b252...4d5a46 )
by ARCANEDEV
04:35
created

CommentsCountComposer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0
ccs 0
cts 3
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 7 1
1
<?php namespace Arcanesoft\Blog\ViewComposers\Dashboard;
2
3
use Arcanesoft\Blog\ViewComposers\AbstractComposer;
4
use Illuminate\Contracts\View\View;
5
6
/**
7
 * Class     CommentsCountComposer
8
 *
9
 * @package  Arcanesoft\Blog\ViewComposers\Dashboard
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class CommentsCountComposer extends AbstractComposer
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Constants
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    const VIEW = 'blog::admin._composers.dashboard.comments-total-box';
19
20
    /* ------------------------------------------------------------------------------------------------
21
     |  Main Functions
22
     | ------------------------------------------------------------------------------------------------
23
     */
24
    /**
25
     * Compose the view.
26
     *
27
     * @param  \Illuminate\Contracts\View\View  $view
28
     */
29
    public function compose(View $view)
30
    {
31
//        $comments = $this->cachedComments();
32
//        $view->with('', $comments->count());
33
34
        $view->with('commentsCount', rand(1000, 2000));
35
    }
36
37
    /**
38
     * Get the cached comments.
39
     *
40
     * @return \Illuminate\Database\Eloquent\Collection
41
     */
42
//    protected function cachedComments()
43
//    {
44
//        return $this->cacheResults('comments.all', function () {
45
//            return Comment::all();
46
//        });
47
//    }
48
}
49