-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathPageController.php
More file actions
80 lines (72 loc) · 2.51 KB
/
PageController.php
File metadata and controls
80 lines (72 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\CMS\Article;
use App\Models\CMS\Category;
use App\Models\CMS\Page;
use App\Services\SitemapService;
class PageController extends Controller
{
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getIndex()
{
$totalDesa = 0;
$pendudukSummary = 0;
$configSummary = 0;
$bantuanSummary = 0;
$categoriesItems = [
['key' => 'penduduk', 'text' => 'penduduk', 'value' => $pendudukSummary, 'icon' => 'web/img/penduduk.jpg'],
['key' => 'kabupaten', 'text' => config('app.sebutanKab'), 'value' => $configSummary, 'icon' => 'web/img/kecamatan.jpg'],
['key' => 'kecamatan', 'text' => 'kecamatan', 'value' => $configSummary, 'icon' => 'web/img/kecamatan.jpg'],
['key' => 'desa', 'text' => config('app.sebutanDesa'), 'value' => $totalDesa, 'icon' => 'web/img/kelurahan.jpg'],
['key' => 'bantuan', 'text' => 'bantuan', 'value' => $bantuanSummary, 'icon' => 'web/img/bantuan.jpg'],
];
$listKabupaten = ['' => 'Pilih '.config('app.sebutanKab')];
$listKecamatan = ['' => 'Pilih Kecamatan'];
$listDesa = ['' => 'Pilih '.config('app.sebutanDesa')];
return view('web.index', compact('categoriesItems', 'listKecamatan', 'listDesa', 'listKabupaten'));
}
/**
* @param \App\Models\Category $category
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getCategory(Category $category)
{
return view('web.articles', [
'title' => $category->name,
'articles' => Article::where('category_id', $category->id)->paginate(4),
]);
}
/**
* @param \App\Models\Page $page
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getPage(Page $page)
{
return view('web.page', ['object' => $page]);
}
/**
* @param \App\Models\Article $article
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getArticle(Article $article)
{
return view('web.article', ['object' => $article]);
}
/**
* @param \App\Base\Services\SitemapService $sitemapService
*
* @return mixed
*
* @throws \Exception
*/
public function getSitemap(SitemapService $sitemapService)
{
return $sitemapService->render();
}
}