|
3 | 3 | namespace App\Http\Controllers; |
4 | 4 |
|
5 | 5 | use App\Http\Services\DocService; |
6 | | -use App\Http\Services\SeoService; |
7 | 6 | use App\Http\Services\PackageService; |
| 7 | +use App\Http\Services\SeoService; |
8 | 8 | use App\Models\OnlineEvent; |
9 | 9 |
|
10 | 10 | /** |
|
13 | 13 | * @property SeoService $seoService |
14 | 14 | * @property DocService $docService |
15 | 15 | * @property PackageService $packageService |
16 | | - * @package App\Http\Controllers\LandingController |
17 | 16 | */ |
18 | 17 | class LandingController extends Controller |
19 | 18 | { |
20 | | - public function __construct( |
21 | | - SeoService $seoService, |
22 | | - DocService $docService, |
23 | | - PackageService $packageService |
24 | | - ) { |
25 | | - $this->seoService = $seoService; |
26 | | - $this->docService = $docService; |
27 | | - $this->packageService = $packageService; |
28 | | - } |
| 19 | + public function __construct( |
| 20 | + SeoService $seoService, |
| 21 | + DocService $docService, |
| 22 | + PackageService $packageService |
| 23 | + ) { |
| 24 | + $this->seoService = $seoService; |
| 25 | + $this->docService = $docService; |
| 26 | + $this->packageService = $packageService; |
| 27 | + } |
29 | 28 |
|
30 | 29 | /** |
31 | 30 | * Download the latest version of Nylo. |
32 | 31 | * |
33 | | - * @param string $project |
34 | | - * |
| 32 | + * @param string $project |
35 | 33 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
36 | 34 | */ |
37 | | - public function download($project = 'nylo-core/nylo') |
38 | | - { |
39 | | - $downloadUrl = $this->docService->downloadFile($project); |
| 35 | + public function download($project = 'nylo-core/nylo') |
| 36 | + { |
| 37 | + $downloadUrl = $this->docService->downloadFile($project); |
40 | 38 |
|
41 | | - return redirect($downloadUrl); |
42 | | - } |
| 39 | + return redirect($downloadUrl); |
| 40 | + } |
43 | 41 |
|
44 | 42 | /** |
45 | 43 | * Index page for Nylo. |
46 | 44 | * |
47 | 45 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
48 | 46 | */ |
49 | | - public function index() |
50 | | - { |
51 | | - $this->seoService->setTitle(config('app.name') . ' - Powerful Flutter Micro-Framework'); |
| 47 | + public function index() |
| 48 | + { |
| 49 | + $this->seoService->setTitle(config('app.name').' - Powerful Flutter Micro-Framework'); |
52 | 50 |
|
53 | 51 | $event = cache()->remember('event', now()->addHours(1), function () { |
54 | 52 | $events = OnlineEvent::where('end_date', '>', now())->get(); |
55 | 53 | if (empty($events)) { |
56 | 54 | return null; |
57 | 55 | } |
| 56 | + |
58 | 57 | return $events->first(); |
59 | 58 | }); |
60 | 59 |
|
61 | | - return view('pages.index', compact('event')); |
62 | | - } |
| 60 | + return view('pages.index', compact('event')); |
| 61 | + } |
63 | 62 |
|
64 | 63 | /** |
65 | 64 | * Privacy policy page for Nylo. |
66 | 65 | * |
67 | 66 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
68 | 67 | */ |
69 | | - public function privacyPolicy() |
70 | | - { |
71 | | - $this->seoService->setTitle('Privacy policy'); |
| 68 | + public function privacyPolicy() |
| 69 | + { |
| 70 | + $this->seoService->setTitle('Privacy policy'); |
72 | 71 |
|
73 | | - return view('pages.privacy-policy'); |
74 | | - } |
| 72 | + return view('pages.privacy-policy'); |
| 73 | + } |
75 | 74 |
|
76 | 75 | /** |
77 | 76 | * Terms and conditions page for Nylo. |
78 | 77 | * |
79 | 78 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
80 | 79 | */ |
81 | | - public function termsAndConditions() |
82 | | - { |
83 | | - $this->seoService->setTitle('Terms and conditions'); |
| 80 | + public function termsAndConditions() |
| 81 | + { |
| 82 | + $this->seoService->setTitle('Terms and conditions'); |
84 | 83 |
|
85 | | - return view('pages.terms-and-conditions'); |
86 | | - } |
| 84 | + return view('pages.terms-and-conditions'); |
| 85 | + } |
87 | 86 |
|
88 | 87 | /** |
89 | 88 | * Resources page for Nylo. |
90 | 89 | * |
91 | 90 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
92 | 91 | */ |
93 | | - public function resources() |
94 | | - { |
95 | | - $this->seoService->setTitle('Resources'); |
96 | | - $resourceData = $this->packageService->getResourceMetaData(); |
| 92 | + public function resources() |
| 93 | + { |
| 94 | + $this->seoService->setTitle('Resources'); |
| 95 | + $resourceData = $this->packageService->getResourceMetaData(); |
97 | 96 |
|
98 | | - return view('pages.resources', compact('resourceData')); |
99 | | - } |
| 97 | + return view('pages.resources', compact('resourceData')); |
| 98 | + } |
100 | 99 |
|
101 | | - /** |
| 100 | + /** |
102 | 101 | * Ecosystem page for Nylo. |
103 | 102 | * |
104 | 103 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
105 | 104 | */ |
106 | | - public function ecosystem() |
107 | | - { |
108 | | - $this->seoService->setTitle('Ecosystem'); |
| 105 | + public function ecosystem() |
| 106 | + { |
| 107 | + $this->seoService->setTitle('Ecosystem'); |
109 | 108 | $resourceData = $this->packageService->getResourceMetaData(); |
110 | 109 |
|
111 | | - return view('pages.ecosystem', compact('resourceData')); |
112 | | - } |
| 110 | + return view('pages.ecosystem', compact('resourceData')); |
| 111 | + } |
113 | 112 |
|
114 | 113 | /** |
115 | 114 | * Tutorials page for Nylo. |
116 | 115 | * |
117 | 116 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
118 | 117 | */ |
119 | | - public function tutorials($version = null, $page = 'introduction') |
120 | | - { |
121 | | - $this->seoService->setTitle('Tutorials'); |
| 118 | + public function tutorials($version = null, $page = 'introduction') |
| 119 | + { |
| 120 | + $this->seoService->setTitle('Tutorials'); |
122 | 121 |
|
123 | 122 | $latestVersionOfNylo = $this->docService->getLastestVersionNylo(); |
124 | 123 |
|
125 | | - if ($version == null) { |
126 | | - $version = $latestVersionOfNylo; |
127 | | - } |
| 124 | + if ($version == null) { |
| 125 | + $version = $latestVersionOfNylo; |
| 126 | + } |
128 | 127 | $this->docService->containsTutorialsForVersion($version); |
129 | 128 | $section = $this->docService->findTutorialSection($version, $page); |
130 | | - $viewingOldDocs = $this->docService->isViewingOldDocs($version); |
| 129 | + $viewingOldDocs = $this->docService->isViewingOldDocs($version); |
131 | 130 | $tutorial = $this->docService->getTutorial($version, $page); |
132 | 131 | abort_if(empty($tutorial), 404); |
133 | 132 |
|
134 | | - return view('docs.tutorials', compact('page', 'tutorial', 'version', 'section', 'latestVersionOfNylo', 'viewingOldDocs')); |
135 | | - } |
| 133 | + return view('docs.tutorials', compact('page', 'tutorial', 'version', 'section', 'latestVersionOfNylo', 'viewingOldDocs')); |
| 134 | + } |
136 | 135 |
|
137 | 136 | /** |
138 | 137 | * Documentation page for Nylo. |
139 | 138 | * |
140 | | - * @param string $version |
141 | | - * @param string $page |
142 | | - * |
| 139 | + * @param string $version |
| 140 | + * @param string $page |
143 | 141 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View |
144 | 142 | */ |
145 | | - public function docs($version = null, $page = 'installation') |
146 | | - { |
147 | | - $this->seoService->setSeoViewingDocs($page); |
148 | | - $latestVersionOfNylo = $this->docService->getLastestVersionNylo(); |
| 143 | + public function docs($version = null, $page = 'installation') |
| 144 | + { |
| 145 | + $this->seoService->setSeoViewingDocs($page); |
| 146 | + $latestVersionOfNylo = $this->docService->getLastestVersionNylo(); |
149 | 147 |
|
150 | | - if ($version == null) { |
151 | | - $version = $latestVersionOfNylo; |
152 | | - } |
| 148 | + if ($version == null) { |
| 149 | + $version = $latestVersionOfNylo; |
| 150 | + } |
153 | 151 |
|
154 | | - $mdDocPage = $this->docService->checkIfDocExists($version, $page); |
| 152 | + $mdDocPage = $this->docService->checkIfDocExists($version, $page); |
155 | 153 |
|
156 | | - $section = $this->docService->findDocSection($version, $page); |
157 | | - $viewingOldDocs = $this->docService->isViewingOldDocs($version); |
158 | | - $docsContainPage = $this->docService->checkDocsContainPage($version, $page); |
| 154 | + $section = $this->docService->findDocSection($version, $page); |
| 155 | + $viewingOldDocs = $this->docService->isViewingOldDocs($version); |
| 156 | + $docsContainPage = $this->docService->checkDocsContainPage($version, $page); |
159 | 157 |
|
160 | | - return view('docs.template', compact('page', 'version', 'mdDocPage', 'section', 'latestVersionOfNylo', 'viewingOldDocs', 'docsContainPage')); |
161 | | - } |
| 158 | + return view('docs.template', compact('page', 'version', 'mdDocPage', 'section', 'latestVersionOfNylo', 'viewingOldDocs', 'docsContainPage')); |
| 159 | + } |
162 | 160 |
|
163 | 161 | /** |
164 | 162 | * Learn more page for Nylo. |
|
0 commit comments