PHP
1
Вклад в тег
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.com/add/?token=TOKEN&id=ID8&value=100&name=TEST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => new CurlFile($_SERVER['DOCUMENT_ROOT'] . '/upload/test.txt')]);
$headers = array();
$headers[] = 'Content-Type: multipart/form-data; boundary=---011000010111000001101001';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result;
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
Route::get('/page', [PageController::class, 'index'])->name('page')->middleware('role:admin,manager');
...
public function handle($request, Closure $next, $role1, $role2)
{
//Используем уже здесь $role1, $role2
...
Route::get('/page', [PageController::class, 'index'])->name('page')->middleware('role:admin|manager');
...
public function handle($request, Closure $next, $role)
{
if (!is_array($role)) {
$roles = explode('|', $role);
}
...