<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use App\Models\Setting;
use DateTime;
use Yajra\DataTables\Facades\DataTables;

class SettingController extends Controller
{

    public function index(Request $request)
    {
        $setting = Setting::latest()->first();
      
        return view('admin.settings.index',compact('setting'));
    }

    public function create()
    {
       
    }

    public function store(Request $request)
    {
       
    }

    public function show(License $setting)
    {
        
    }

    public function edit(Setting $setting)
    {
        return view('admin.settings.edit', compact('setting'));
    }

    public function update(Request $request, Setting $setting)
    {
        $request->validate([
            'license_validity_in_months' => 'required|integer', // Ajoutez les règles de validation nécessaires
        ]);

        $setting->update($request->all());

        return redirect()->route('admin.settings.index')
            ->with('success', 'Setting updated successfully.');
    }


    public function destroy(License $setting)
    {
    
    }
}
