1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace crocodicstudio\crudbooster\controllers; |
4
|
|
|
|
5
|
|
|
use crocodicstudio\crudbooster\controllers\ApiController\ApiHooks; |
6
|
|
|
use crocodicstudio\crudbooster\controllers\ApiController\ExecuteApi; |
7
|
|
|
use Illuminate\Support\Facades\Storage; |
8
|
|
|
use Illuminate\Support\Facades\Request; |
9
|
|
|
use Illuminate\Support\Facades\DB; |
10
|
|
|
use Illuminate\Support\Facades\Hash; |
11
|
|
|
use Illuminate\Support\Facades\Validator; |
12
|
|
|
use CRUDBooster; |
|
|
|
|
13
|
|
|
|
14
|
|
|
class ApiController extends Controller |
15
|
|
|
{ |
16
|
|
|
use ApiHooks; |
17
|
|
|
var $method_type; |
18
|
|
|
|
19
|
|
|
var $permalink; |
20
|
|
|
|
21
|
|
|
var $hook_api_status; |
22
|
|
|
|
23
|
|
|
var $hook_api_message; |
24
|
|
|
|
25
|
|
|
var $validate = false; |
26
|
|
|
|
27
|
|
|
var $last_id_tmp = []; |
28
|
|
|
|
29
|
|
|
public function hook_api_status($boolean) |
30
|
|
|
{ |
31
|
|
|
$this->hook_api_status = $boolean; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function hook_api_message($message) |
35
|
|
|
{ |
36
|
|
|
$this->hook_api_message = $message; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function execute_api() |
40
|
|
|
{ |
41
|
|
|
return (new ExecuteApi($this))->execute(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param $name |
46
|
|
|
* @param $row_assign |
47
|
|
|
* @return array |
48
|
|
|
*/ |
49
|
|
|
/*private function handleFile($name, $row_assign) |
50
|
|
|
{ |
51
|
|
|
if (! Request::hasFile($name)) { |
52
|
|
|
return; |
53
|
|
|
} |
54
|
|
|
$file = Request::file($name); |
55
|
|
|
$ext = $file->getClientOriginalExtension(); |
56
|
|
|
|
57
|
|
|
//Create Directory Monthly |
58
|
|
|
Storage::makeDirectory(date('Y-m')); |
59
|
|
|
|
60
|
|
|
//Move file to storage |
61
|
|
|
$filename = md5(str_random(5)).'.'.$ext; |
62
|
|
|
if ($file->move(storage_path('app'.DIRECTORY_SEPARATOR.date('Y-m')), $filename)) { |
63
|
|
|
$v = 'uploads/'.date('Y-m').'/'.$filename; |
64
|
|
|
$row_assign[$name] = $v; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return $row_assign; |
68
|
|
|
}*/ |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param $value |
72
|
|
|
* @param $uploads_format_candidate |
73
|
|
|
* @param $row_assign |
74
|
|
|
* @param $name |
75
|
|
|
* @return mixed |
76
|
|
|
*/ |
77
|
|
|
/* private function handleBase64($value, $uploads_format_candidate, $row_assign, $name) |
78
|
|
|
{ |
79
|
|
|
$filedata = base64_decode($value); |
80
|
|
|
$f = finfo_open(); |
81
|
|
|
$mime_type = finfo_buffer($f, $filedata, FILEINFO_MIME_TYPE); |
82
|
|
|
@$mime_type = explode('/', $mime_type); |
83
|
|
|
@$mime_type = $mime_type[1]; |
84
|
|
|
|
85
|
|
|
if ($mime_type && in_array($mime_type, $uploads_format_candidate)) { |
86
|
|
|
Storage::makeDirectory(date('Y-m')); |
87
|
|
|
$filename = md5(str_random(5)).'.'.$mime_type; |
88
|
|
|
if (file_put_contents(storage_path('app'.DIRECTORY_SEPARATOR.date('Y-m')).'/'.$filename, $filedata)) { |
89
|
|
|
$v = 'uploads/'.date('Y-m').'/'.$filename; |
90
|
|
|
$row_assign[$name] = $v; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
return $row_assign; |
95
|
|
|
}*/ |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
|
100
|
|
|
|
101
|
|
|
|
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