ikinci temizlik tamamlandı
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// Retrieve parameters
|
||||
$typeId = request('type_id');
|
||||
$permissions = request('permissions'); // JSON string
|
||||
$mobileColumns = request('mobile_columns'); // JSON string
|
||||
|
||||
if (!$typeId) {
|
||||
echo json_encode(['status' => 'error', 'message' => 'Missing Type ID']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$key = "type_{$typeId}_specific_permissions";
|
||||
|
||||
// Update or Insert into settings table
|
||||
try {
|
||||
$exists = db('settings')->where('title', $key)->exists();
|
||||
|
||||
if ($exists) {
|
||||
db('settings')->where('title', $key)->update(['html' => $permissions]);
|
||||
} else {
|
||||
db('settings')->insert([
|
||||
'title' => $key,
|
||||
'html' => $permissions
|
||||
]);
|
||||
}
|
||||
|
||||
// Save mobile columns if provided
|
||||
if ($mobileColumns !== null) {
|
||||
$mcKey = "type_{$typeId}_mobile_columns";
|
||||
$mcExists = db('settings')->where('title', $mcKey)->exists();
|
||||
|
||||
if ($mcExists) {
|
||||
db('settings')->where('title', $mcKey)->update(['html' => $mobileColumns]);
|
||||
} else {
|
||||
db('settings')->insert([
|
||||
'title' => $mcKey,
|
||||
'html' => $mobileColumns
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['status' => 'success']);
|
||||
} catch (\Exception $e) {
|
||||
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user