Passed
Push — master ( 5c0c69...46ba0d )
by Georgi
03:26
created

SystemController::index()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Epesi\Core\Controllers;
4
5
use Illuminate\Routing\Controller;
6
use Epesi\Core\System\SystemCore;
7
use Epesi\Core\HomePage\HomePageCommon;
8
use Epesi\Core\App as Epesi;
9
use Epesi\Core\System\SystemInstallWizard;
10
use Illuminate\Support\Facades\File;
11
12
class SystemController extends Controller
13
{
14
    public function index()
15
    {
16
    	return SystemCore::isInstalled()? redirect('home'): redirect('install');
17
    }
18
    
19
    public function install(Epesi $epesi)
20
    {
21
    	if (SystemCore::isInstalled()) return redirect('home');
22
    	
23
    	$epesi->title = config('epesi.app.title') . ' > ' . __('Installation');
24
    	
25
    	$epesi->initLayout('Centered');
26
    	
27
    	$epesi->layout->set('logo', url('logo'));
28
    	$epesi->layout->template->setHTML('copyright', config('epesi.app.copyright'));
29
    	
30
    	$epesi->add(new SystemInstallWizard());
31
    	
32
    	return $epesi->response();
33
    }
34
    
35
    public function home()
36
    {
37
    	return redirect(HomePageCommon::getUserHomePagePath());
38
    }
39
    
40
    public function logo()
41
    {
42
    	$path = storage_path(implode(DIRECTORY_SEPARATOR, ['app', 'public', 'system', 'logo.png']));
43
44
    	$file = new \Symfony\Component\HttpFoundation\File\File($path);
45
    	
46
    	return response(File::get($path), 200, ['Content-type' => $file->getMimeType()])->setMaxAge(604800)->setPublic();
47
    }
48
}
49