Add initial Code
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user