zarbox added 6

This commit is contained in:
2026-06-04 16:01:13 +03:30
parent 9b0d360dcf
commit bdafca0f1d
4 changed files with 616 additions and 5 deletions
@@ -9,12 +9,17 @@ use Illuminate\Support\Facades\Artisan;
class SettingsController extends Controller
{
public function index(){
$Setting = Setting::where('can_edit', 1)
public function index(Request $request)
{
$query = Setting::query()
->select(Setting::adminSelectColumns())
->get();
->orderBy('key');
return response()->json($Setting);
if (!$request->boolean('editable_only')) {
return response()->json($query->get());
}
return response()->json($query->where('can_edit', 1)->get());
}
public function edit(Request $request)
{
+1 -1
View File
@@ -34,7 +34,7 @@ class Setting extends Model
/** @return array<int, string> */
public static function adminSelectColumns(): array
{
$cols = ['id', 'title_fa', 'key', 'value', 'description', 'is_active'];
$cols = ['id', 'title_fa', 'key', 'value', 'description', 'is_active', 'can_edit'];
if (static::hasTypeColumn()) {
$cols[] = 'type';
}