1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MeestorHok\Blue\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use MeestorHok\Blue\Http\Controllers\Controller; |
6
|
|
|
use Illuminate\Http\Request; |
7
|
|
|
use SEO; |
8
|
|
|
|
9
|
|
|
class SiteController extends Controller |
10
|
|
|
{ |
11
|
|
|
public function showCreateForm () |
12
|
|
|
{ |
13
|
|
|
return SEO::make([ |
14
|
|
|
'title' => 'New Site', |
15
|
|
|
'description' => 'You currently don\'t have a site! Create one now to get started!' |
16
|
|
|
], 'Blue::auth.new-site'); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function createSite (Request $request) |
20
|
|
|
{ |
21
|
|
|
// 'title', 'social_links', 'description', 'slogan', |
|
|
|
|
22
|
|
|
// 'keywords', 'copyright', 'is_public_site', 'logo' |
|
|
|
|
23
|
|
|
$this->validate($request, [ |
24
|
|
|
'siteName' => 'required|unique:sites,title|max:100', |
25
|
|
|
'slogan' => 'max:155', |
26
|
|
|
'description' => 'required|max:255', |
27
|
|
|
'copyright' => 'max:100' |
28
|
|
|
], [ |
29
|
|
|
'siteName.required' => 'Your site must have a name!', |
30
|
|
|
'siteName.unique' => 'You already own a site by that name.', |
31
|
|
|
'description.required' => 'Tell us a little about the site.' |
32
|
|
|
]); |
33
|
|
|
|
34
|
|
|
Site::create([ |
35
|
|
|
'title' => $request->siteName, |
36
|
|
|
'slogan' => $request->slogan, |
37
|
|
|
'description' => $request->description, |
38
|
|
|
'copyright' => $request->copyright, |
39
|
|
|
'is_public_site' => 1, |
40
|
|
|
'social_links' => json_encode($socialLinks), |
|
|
|
|
41
|
|
|
'keywords' => implode(',', $keywords) |
|
|
|
|
42
|
|
|
]); |
43
|
|
|
|
44
|
|
|
return redirect()->route('create.admin'); |
45
|
|
|
} |
46
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.