1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin; |
4
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
6
|
|
|
use App\Http\Requests\GenerateSitemapRequest; |
7
|
|
|
use Illuminate\Support\Facades\Artisan; |
8
|
|
|
use Spatie\Sitemap\Sitemap; |
9
|
|
|
|
10
|
|
|
class AdminController extends Controller |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Create a new controller instance. |
14
|
|
|
* |
15
|
|
|
* @return void |
16
|
|
|
*/ |
17
|
|
|
public function __construct() |
18
|
|
|
{ |
19
|
|
|
$this->middleware('auth'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Show the application dashboard. |
24
|
|
|
* |
25
|
|
|
* @return \Illuminate\Http\Response |
26
|
|
|
*/ |
27
|
|
|
public function index() |
28
|
|
|
{ |
29
|
|
|
return view('admin.pages.home'); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Show the application files manager/uploads dashboard. |
34
|
|
|
* |
35
|
|
|
* @return \Illuminate\Http\Response |
36
|
|
|
*/ |
37
|
|
|
public function uploads() |
38
|
|
|
{ |
39
|
|
|
return view('admin.pages.uploads'); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Show the application sitemap dashboard. |
44
|
|
|
* |
45
|
|
|
* @return \Illuminate\Http\Response |
46
|
|
|
*/ |
47
|
|
|
public function sitemap() |
48
|
|
|
{ |
49
|
|
|
$sitemap = base_path('public/sitemap.xml'); |
50
|
|
|
$modified = null; |
51
|
|
|
$sitemapxml = []; |
52
|
|
|
|
53
|
|
|
if (file_exists($sitemap)) { |
54
|
|
|
$sitemapxml = simplexml_load_file($sitemap); |
55
|
|
|
$modified = date ("F jS, Y H:i:s", filemtime($sitemap)); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
$data = [ |
59
|
|
|
'sitemap' => $sitemapxml, |
60
|
|
|
'modified' => $modified, |
61
|
|
|
]; |
62
|
|
|
|
63
|
|
|
return view('admin.pages.sitemap', $data); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Generate Sitemap from Artisan Command via Request |
68
|
|
|
* |
69
|
|
|
* @param \App\Http\Requests\GenerateSitemapRequest |
70
|
|
|
* |
71
|
|
|
* @return \Illuminate\Http\Response |
72
|
|
|
*/ |
73
|
|
|
public function generateSitemap(GenerateSitemapRequest $request) |
74
|
|
|
{ |
75
|
|
|
Artisan::call('sitemap:generate', ['limit' => $request->limit]); |
76
|
|
|
|
77
|
|
|
return redirect()->back()->withSuccess(trans('forms.sitemap.messages.success')); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
} |
81
|
|
|
|