function getCookie(name){
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
var cidLong = getCookie('_ga');
var tmp = cidLong.split('.');
var cid = tmp[2] + '.' + tmp[3];
console.log(cid);
public function getFiles()
{
$path = public_path('images');
$files = File::files($path);
return $files;
}
$.get( "{!! route('your_url') !!}", function( data ) {
console.log(data);
});
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);
}
...
...
$perms = auth()->user()->permissions;
$records= array();
foreach($perms as $perm){
if (strpos($perm->slug, 'record-') !== false) {
$records[] = str_replace('record-','',$perm->slug);
}
}
$table = Record::query();
$table->whereIn('name_record', $records);
return Datatables::eloquent($table)
...
$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);