Completed
Push — master ( ba16c1...577bec )
by ARCANEDEV
13s
created

BackupsController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 9.4285
1
<?php namespace Arcanesoft\Foundation\Http\Controllers\Admin\System;
2
3
use Arcanesoft\Foundation\Services\Backups;
4
5
/**
6
 * Class     BackupsController
7
 *
8
 * @package  Arcanesoft\Foundation\Http\Controllers\Admin\System
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class BackupsController extends Controller
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Constructor
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * BackupsController constructor.
19
     */
20
    public function __construct()
21
    {
22
        parent::__construct();
23
24
        $this->setCurrentPage('foundation-system-backups');
25
        $this->addBreadcrumbRoute('Backups', 'admin::foundation.system.backups.index');
26
    }
27
28
    /* ------------------------------------------------------------------------------------------------
29
     |  Main Functions
30
     | ------------------------------------------------------------------------------------------------
31
     */
32
    public function index()
33
    {
34
        $this->setTitle('Backups');
35
        $this->addBreadcrumb('List of all backup statuses');
36
37
        $statuses = Backups::statuses();
38
39
        return $this->view('admin.system.backups.index', compact('statuses'));
40
    }
41
42
    public function show($index)
43
    {
44
        $status = Backups::getStatus($index);
45
46
        if (is_null($status)) self::pageNotFound();
47
48
        $this->setTitle('Backups');
49
        $this->addBreadcrumb('List of all backups');
50
51
        $backups = $status->backupDestination()->backups();
52
53
        return $this->view('admin.system.backups.show', compact('status', 'backups'));
54
    }
55
}
56