1 | <?php |
||||||
2 | |||||||
3 | namespace Lionix\SeoManager\Controllers; |
||||||
4 | |||||||
5 | use App\Http\Controllers\Controller; |
||||||
0 ignored issues
–
show
|
|||||||
6 | use Illuminate\Http\Request; |
||||||
0 ignored issues
–
show
The type
Illuminate\Http\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
7 | // use Illuminate\Support\Facades\Input; // Outdated in Laravel 6 |
||||||
8 | use Illuminate\Support\Facades\Schema; |
||||||
9 | use Lionix\SeoManager\Models\SeoManager as SeoManagerModel; |
||||||
10 | use Lionix\SeoManager\Models\Translate; |
||||||
11 | use Lionix\SeoManager\Traits\SeoManagerTrait; |
||||||
12 | |||||||
13 | class ManagerController extends Controller |
||||||
14 | { |
||||||
15 | use SeoManagerTrait; |
||||||
16 | |||||||
17 | protected $locale; |
||||||
18 | |||||||
19 | public function __construct(Request $request) |
||||||
20 | { |
||||||
21 | if($request->get('locale')){ |
||||||
22 | app()->setLocale($request->get('locale')); |
||||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
23 | $this->locale = app()->getLocale(); |
||||||
24 | } |
||||||
25 | } |
||||||
26 | |||||||
27 | /** |
||||||
28 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||||||
0 ignored issues
–
show
The type
Illuminate\View\View was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
29 | */ |
||||||
30 | public function index() |
||||||
31 | { |
||||||
32 | return view('seo-manager::index'); |
||||||
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
33 | } |
||||||
34 | |||||||
35 | /** |
||||||
36 | * @return \Illuminate\Http\JsonResponse |
||||||
0 ignored issues
–
show
The type
Illuminate\Http\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
37 | */ |
||||||
38 | public function getRoutes() |
||||||
39 | { |
||||||
40 | $routes = SeoManagerModel::all(); |
||||||
41 | return response()->json(['routes' => $routes]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
42 | } |
||||||
43 | |||||||
44 | /** |
||||||
45 | * @return \Illuminate\Http\JsonResponse |
||||||
46 | */ |
||||||
47 | public function getModels() |
||||||
48 | { |
||||||
49 | try { |
||||||
50 | $models = $this->getAllModels(); |
||||||
51 | return response()->json(['models' => $models]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
52 | } catch (\Exception $exception) { |
||||||
53 | return response()->json(['status' => false, 'message' => $exception->getMessage()]); |
||||||
54 | } |
||||||
55 | } |
||||||
56 | |||||||
57 | /** |
||||||
58 | * @param Request $request |
||||||
59 | * @return \Illuminate\Http\JsonResponse |
||||||
60 | * @throws \Throwable |
||||||
61 | */ |
||||||
62 | public function getModelColumns(Request $request) |
||||||
63 | { |
||||||
64 | try { |
||||||
65 | $model = $request->get('model'); |
||||||
66 | $columns = $this->getColumns($model); |
||||||
67 | return response()->json(['columns' => $columns]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
68 | } catch (\Exception $exception) { |
||||||
69 | return response()->json(['status' => false, 'message' => $exception->getMessage()]); |
||||||
70 | } |
||||||
71 | } |
||||||
72 | |||||||
73 | /** |
||||||
74 | * @param Request $request |
||||||
75 | * @return \Illuminate\Http\JsonResponse |
||||||
76 | */ |
||||||
77 | public function storeData(Request $request) |
||||||
78 | { |
||||||
79 | $allowedColumns = Schema::getColumnListing(config('seo-manager.database.table')); |
||||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
80 | try { |
||||||
81 | $id = $request->get('id'); |
||||||
82 | $type = $request->get('type'); |
||||||
83 | $seoManager = SeoManagerModel::find($id); |
||||||
84 | if (in_array($type, $allowedColumns)) { |
||||||
85 | $data = $request->get($type); |
||||||
86 | if($type != 'mapping' && $this->locale !== config('seo-manager.locale')){ |
||||||
87 | $translate = $seoManager->translation()->where('locale', $this->locale)->first(); |
||||||
88 | if(!$translate){ |
||||||
89 | $newInst = new Translate(); |
||||||
90 | $newInst->locale = $this->locale; |
||||||
91 | $translate = $seoManager->translation()->save($newInst); |
||||||
92 | } |
||||||
93 | $translate->$type = $data; |
||||||
94 | $translate->save(); |
||||||
95 | }else{ |
||||||
96 | $seoManager->$type = $data; |
||||||
97 | $seoManager->save(); |
||||||
98 | } |
||||||
99 | } |
||||||
100 | return response()->json([$type => $seoManager->$type]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
101 | } catch (\Exception $exception) { |
||||||
102 | return response()->json(['status' => false, 'message' => $exception->getMessage()]); |
||||||
103 | } |
||||||
104 | } |
||||||
105 | |||||||
106 | /** |
||||||
107 | * @param Request $request |
||||||
108 | * @return \Illuminate\Http\JsonResponse |
||||||
109 | */ |
||||||
110 | public function getExampleTitle(Request $request) |
||||||
111 | { |
||||||
112 | $route = $request->get('route'); |
||||||
113 | try { |
||||||
114 | $manager = SeoManagerModel::find($route['id']); |
||||||
115 | $titles = $route['title_dynamic']; |
||||||
116 | $exampleTitle = $this->getDynamicTitle($titles, $manager); |
||||||
117 | return response()->json(['example_title' => $exampleTitle]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
118 | } catch (\Exception $exception) { |
||||||
119 | return response()->json(['status' => false, 'message' => $exception->getMessage()]); |
||||||
120 | } |
||||||
121 | } |
||||||
122 | |||||||
123 | /** |
||||||
124 | * @param Request $request |
||||||
125 | * @return \Illuminate\Http\JsonResponse |
||||||
126 | */ |
||||||
127 | public function deleteRoute(Request $request) |
||||||
128 | { |
||||||
129 | try { |
||||||
130 | SeoManagerModel::destroy($request->id); |
||||||
131 | return response()->json(['deleted' => true]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
132 | } catch (\Exception $exception) { |
||||||
133 | return response()->json(['status' => false, 'message' => $exception->getMessage()]); |
||||||
134 | } |
||||||
135 | } |
||||||
136 | |||||||
137 | /** |
||||||
138 | * @param Request $request |
||||||
139 | * @return array|null |
||||||
140 | */ |
||||||
141 | public function sharingPreview(Request $request) |
||||||
142 | { |
||||||
143 | $id = $request->get('id'); |
||||||
144 | $seoManager = SeoManagerModel::find($id); |
||||||
145 | if(is_null($seoManager)){ |
||||||
146 | return null; |
||||||
147 | } |
||||||
148 | $ogData = $this->getOgData($seoManager, null); |
||||||
149 | return response()->json(['og_data' => $ogData]); |
||||||
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
150 | } |
||||||
151 | } |
||||||
152 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths