Test Failed
Branch master (d26f96)
by Philippe
02:12
created

MediaLibraryController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Thinktomorrow\AssetLibrary\Http\Controllers;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Pagination\Paginator;
7
use Thinktomorrow\AssetLibrary\Models\Asset;
8
use Illuminate\Pagination\LengthAwarePaginator;
9
10
class MediaLibraryController extends Controller
11
{
12
    public function index()
13
    {
14
        $library = Asset::getAllAssets();
15
16
        $library = new LengthAwarePaginator(
17
            $library->forPage(Paginator::resolveCurrentPage(), 8),
18
            count($library),
19
            8,
20
            Paginator::resolveCurrentPage(),
21
            [
22
                'path' => Paginator::resolveCurrentPath(),
23
            ]);
24
25
        return view('back.media', compact('library'));
26
    }
27
}
28