1 | <?php |
||||||
2 | |||||||
3 | namespace HayriCan\IpChecker\Http\Controllers; |
||||||
4 | |||||||
5 | /** |
||||||
6 | * Laravel IP Checker |
||||||
7 | * |
||||||
8 | * @author Hayri Can BARÇIN <hayricanbarcin (#) gmail (.) com> |
||||||
9 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||||||
10 | * @link https://github.com/HayriCan/laravel-ip-checker |
||||||
11 | */ |
||||||
12 | |||||||
13 | use HayriCan\IpChecker\Contracts\IpCheckerInterface; |
||||||
14 | use App\Http\Controllers\Controller; |
||||||
0 ignored issues
–
show
|
|||||||
15 | 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 ![]() |
|||||||
16 | use Illuminate\Support\Facades\Auth; |
||||||
17 | use Illuminate\Support\Facades\Validator; |
||||||
0 ignored issues
–
show
The type
Illuminate\Support\Facades\Validator 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 ![]() |
|||||||
18 | |||||||
19 | class IpCheckerController extends Controller |
||||||
20 | { |
||||||
21 | /** |
||||||
22 | * Create a new controller instance. |
||||||
23 | * |
||||||
24 | * @return void |
||||||
25 | */ |
||||||
26 | public function __construct() |
||||||
27 | { |
||||||
28 | $this->middleware(['web']); |
||||||
29 | if (config('ipchecker.settings.auth')) { |
||||||
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
![]() |
|||||||
30 | $this->middleware(['web','auth']); |
||||||
31 | $this->middleware(function ($request, $next) { |
||||||
32 | if (!empty(config('ipchecker.settings.admin_id'))){ |
||||||
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
![]() |
|||||||
33 | if (!in_array(Auth::id(),config('ipchecker.settings.admin_id'))){ |
||||||
34 | return abort(404); |
||||||
35 | } |
||||||
36 | } |
||||||
37 | |||||||
38 | return $next($request); |
||||||
39 | }); |
||||||
40 | } |
||||||
41 | } |
||||||
42 | |||||||
43 | /** |
||||||
44 | * Show the application dashboard. |
||||||
45 | * |
||||||
46 | * @param IpCheckerInterface $ipchecker |
||||||
47 | * @return \Illuminate\Contracts\Support\Renderable |
||||||
0 ignored issues
–
show
The type
Illuminate\Contracts\Support\Renderable 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 ![]() |
|||||||
48 | */ |
||||||
49 | public function index(IpCheckerInterface $ipchecker) |
||||||
50 | { |
||||||
51 | $iplist = $ipchecker->getIpList(); |
||||||
52 | |||||||
53 | if(count($iplist)>0){ |
||||||
54 | $iplist = $iplist->sortByDesc('created_at'); |
||||||
55 | } |
||||||
56 | |||||||
57 | return view('ipchecker::index',compact('iplist')); |
||||||
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
![]() |
|||||||
58 | } |
||||||
59 | |||||||
60 | /** |
||||||
61 | * @param Request $request |
||||||
62 | * @param IpCheckerInterface $ipchecker |
||||||
63 | * @return \Illuminate\Http\RedirectResponse |
||||||
0 ignored issues
–
show
The type
Illuminate\Http\RedirectResponse 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 ![]() |
|||||||
64 | */ |
||||||
65 | public function add(Request $request,IpCheckerInterface $ipchecker) |
||||||
66 | { |
||||||
67 | $request_data = $request->all(); |
||||||
68 | $request_validation = array( |
||||||
69 | 'group'=>'required|string', |
||||||
70 | 'definition'=>'required|string', |
||||||
71 | 'ip'=>'required|ip', |
||||||
72 | ); |
||||||
73 | $validator = Validator::make($request_data, $request_validation); |
||||||
74 | if ($validator->fails()) { |
||||||
75 | return redirect()->back()->withErrors($validator->errors()); |
||||||
0 ignored issues
–
show
The function
redirect 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
![]() |
|||||||
76 | } |
||||||
77 | |||||||
78 | if (!in_array($request->input('ip'),$ipchecker->getIpArray())){ |
||||||
79 | $ipchecker->saveIp(array( |
||||||
80 | 'group'=>$request->input('group'), |
||||||
81 | 'definition'=>$request->input('definition'), |
||||||
82 | 'ip'=>$request->input('ip'), |
||||||
83 | )); |
||||||
84 | |||||||
85 | return redirect()->back()->with('success',trans('ipchecker::messages.ip_success')); |
||||||
0 ignored issues
–
show
The function
trans 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
![]() |
|||||||
86 | } |
||||||
87 | |||||||
88 | return redirect()->back()->with('error',trans('ipchecker::messages.ip_error')); |
||||||
89 | } |
||||||
90 | |||||||
91 | /** |
||||||
92 | * @param Request $request |
||||||
93 | * @param IpCheckerInterface $ipchecker |
||||||
94 | * @return \Illuminate\Http\RedirectResponse |
||||||
95 | */ |
||||||
96 | public function delete(Request $request,IpCheckerInterface $ipchecker) |
||||||
97 | { |
||||||
98 | $ipchecker->deleteIp($request->input('ipAddress')); |
||||||
99 | |||||||
100 | return redirect()->back()->with('info',trans('ipchecker::messages.ip_delete')); |
||||||
0 ignored issues
–
show
The function
trans 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
![]() The function
redirect 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 | } |
||||||
102 | } |
||||||
103 |
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