27 lines
594 B
PHP
27 lines
594 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers;
|
||
|
|
|
||
|
|
use App\Models\Setting;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
|
||
|
|
class SettingController extends Controller
|
||
|
|
{
|
||
|
|
public function index()
|
||
|
|
{
|
||
|
|
return Setting::firstOrCreate([]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function update(Request $request)
|
||
|
|
{
|
||
|
|
$validatedData = $request->validate([
|
||
|
|
'invoice_number_format' => 'required|string',
|
||
|
|
'invoice_number_start' => 'required|integer',
|
||
|
|
]);
|
||
|
|
|
||
|
|
$setting = Setting::firstOrCreate([]);
|
||
|
|
$setting->update($validatedData);
|
||
|
|
|
||
|
|
return response()->json($setting, 200);
|
||
|
|
}
|
||
|
|
}
|