1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Larafolio\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use View; |
6
|
|
|
use Larafolio\Models\Page; |
7
|
|
|
use Larafolio\Models\Project; |
8
|
|
|
|
9
|
|
|
class SettingsController extends Controller |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Show the requested settings page if it exists. |
13
|
|
|
* |
14
|
|
|
* @param string $page Settings page name. |
15
|
|
|
* |
16
|
|
|
* @return \Illuminate\Http\Response |
17
|
|
|
*/ |
18
|
|
|
public function show($page) |
19
|
|
|
{ |
20
|
|
|
if (!View::exists("larafolio::settings.{$page}")) { |
21
|
|
|
abort(404); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
if (method_exists($this, $method = 'show'.ucfirst($page))) { |
25
|
|
|
return $this->{$method}(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
return view("larafolio::settings.{$page}"); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Show the projects settings page. |
33
|
|
|
* |
34
|
|
|
* @return \Illuminate\Http\Response |
35
|
|
|
*/ |
36
|
|
|
private function showProjects() |
37
|
|
|
{ |
38
|
|
|
$deletedProjects = Project::onlyTrashed() |
39
|
|
|
->orderBy('deleted_at', 'DESC') |
40
|
|
|
->get() |
41
|
|
|
->map(function (Project $project) { |
42
|
|
|
return $project->generateProps(); |
43
|
|
|
}); |
44
|
|
|
|
45
|
|
|
return view('larafolio::settings.projects', [ |
46
|
|
|
'deletedProjects' => $deletedProjects, |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Show the pages settings page. |
52
|
|
|
* |
53
|
|
|
* @return \Illuminate\Http\Response |
54
|
|
|
*/ |
55
|
|
|
private function showPages() |
56
|
|
|
{ |
57
|
|
|
$deletedPages = Page::onlyTrashed() |
|
|
|
|
58
|
|
|
->orderBy('deleted_at', 'DESC') |
59
|
|
|
->get() |
60
|
|
|
->map(function (Page $page) { |
61
|
|
|
return $page->generateProps(); |
62
|
|
|
}); |
63
|
|
|
|
64
|
|
|
return view('larafolio::settings.pages', [ |
65
|
|
|
'deletedPages' => $deletedPages, |
66
|
|
|
]); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.