1
|
|
|
<?php namespace Arcanesoft\Seo\Http\Controllers\Admin; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Seo\Entities\Locales; |
4
|
|
|
use Arcanesoft\Seo\Http\Requests\Admin\Footers\CreateFooterRequest; |
5
|
|
|
use Arcanesoft\Seo\Http\Requests\Admin\Footers\UpdateFooterRequest; |
6
|
|
|
use Arcanesoft\Seo\Models\Footer; |
7
|
|
|
use Arcanesoft\Seo\Models\Page; |
8
|
|
|
use Illuminate\Support\Facades\Log; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class FootersController |
12
|
|
|
* |
13
|
|
|
* @package Arcanesoft\Seo\Http\Controllers\Admin |
14
|
|
|
* @author ARCANEDEV <[email protected]> |
15
|
|
|
* |
16
|
|
|
* @todo: Add authorization checks |
17
|
|
|
*/ |
18
|
|
|
class FootersController extends Controller |
19
|
|
|
{ |
20
|
|
|
/* ----------------------------------------------------------------- |
21
|
|
|
| Constructor |
22
|
|
|
| ----------------------------------------------------------------- |
23
|
|
|
*/ |
24
|
|
|
/** |
25
|
|
|
* FootersController constructor. |
26
|
|
|
*/ |
27
|
|
|
public function __construct() |
28
|
|
|
{ |
29
|
|
|
parent::__construct(); |
30
|
|
|
|
31
|
|
|
$this->setCurrentPage('seo-footers'); |
32
|
|
|
$this->addBreadcrumbRoute('Footers', 'admin::seo.footers.index'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/* ----------------------------------------------------------------- |
36
|
|
|
| Main Methods |
37
|
|
|
| ----------------------------------------------------------------- |
38
|
|
|
*/ |
39
|
|
|
public function index() |
40
|
|
|
{ |
41
|
|
|
$this->setTitle($title = 'List of Footers'); |
42
|
|
|
$this->addBreadcrumb($title); |
43
|
|
|
|
44
|
|
|
$footers = Footer::with(['page', 'seo'])->paginate(50); |
45
|
|
|
|
46
|
|
|
return $this->view('admin.footers.index', compact('footers')); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function create() |
50
|
|
|
{ |
51
|
|
|
$this->setTitle($title = 'New Footer'); |
52
|
|
|
$this->addBreadcrumb($title); |
53
|
|
|
|
54
|
|
|
$pages = Page::getSelectInputData(); |
55
|
|
|
$locales = Locales::all(); |
56
|
|
|
|
57
|
|
|
return $this->view('admin.footers.create', compact('pages', 'locales')); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function store(CreateFooterRequest $request) |
61
|
|
|
{ |
62
|
|
|
$inputs = $request->only([ |
63
|
|
|
'name', 'localization', 'uri', 'locale', 'page', |
64
|
|
|
'seo_title', 'seo_description', 'seo_keywords', |
65
|
|
|
]); |
66
|
|
|
|
67
|
|
|
$footer = Footer::createOne($inputs); |
68
|
|
|
|
69
|
|
|
$message = 'The footer was created successfully !'; |
70
|
|
|
Log::info($message, $footer->toArray()); |
71
|
|
|
$this->notifySuccess($message, 'Footer created !'); |
72
|
|
|
|
73
|
|
|
return redirect()->route('admin::seo.footers.show', [$footer]); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function show(Footer $footer) |
77
|
|
|
{ |
78
|
|
|
$this->setTitle($title = 'Footer details'); |
79
|
|
|
$this->addBreadcrumb($title); |
80
|
|
|
|
81
|
|
|
$footer->load(['page', 'seo']); |
82
|
|
|
|
83
|
|
|
return $this->view('admin.footers.show', compact('footer')); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function edit(Footer $footer) |
87
|
|
|
{ |
88
|
|
|
$this->setTitle($title = 'Edit Footer'); |
89
|
|
|
$this->addBreadcrumb($title); |
90
|
|
|
|
91
|
|
|
$footer->load(['page', 'seo']); |
92
|
|
|
|
93
|
|
|
$pages = Page::getSelectInputData(); |
94
|
|
|
$locales = Locales::all(); |
95
|
|
|
|
96
|
|
|
return $this->view('admin.footers.edit', compact('footer', 'pages', 'locales')); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function update(Footer $footer, UpdateFooterRequest $request) |
100
|
|
|
{ |
101
|
|
|
dd($request->all()); |
102
|
|
|
$footer->updateOne( |
103
|
|
|
// |
104
|
|
|
); |
105
|
|
|
|
106
|
|
|
$message = 'The footer was updated successfully !'; |
107
|
|
|
Log::info($message, $footer->toArray()); |
108
|
|
|
$this->notifySuccess($message, 'Footer updated !'); |
109
|
|
|
|
110
|
|
|
return redirect()->route('admin::seo.footers.show', [$footer]); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function delete(Footer $footer) |
114
|
|
|
{ |
115
|
|
|
$footer->delete(); |
116
|
|
|
|
117
|
|
|
$message = 'The footer was deleted successfully !'; |
118
|
|
|
Log::info($message, $footer->toArray()); |
119
|
|
|
$this->notifySuccess($message, 'Footer deleted !'); |
120
|
|
|
|
121
|
|
|
return json_response()->success($message); |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|