menerapkan generate code system di feature Jenis Fasilitas Kredit
This commit is contained in:
@@ -9,9 +9,11 @@
|
||||
use Modules\Lpj\Exports\JenisFasilitasKreditExport;
|
||||
use Modules\Lpj\Http\Requests\JenisFasilitasKreditRequest;
|
||||
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||
use Modules\Lpj\Http\Library\LpjHelpers;
|
||||
|
||||
class JenisFasilitasKreditController extends Controller
|
||||
{
|
||||
use LpjHelpers; // <---- Using the LpjHelpers Trait
|
||||
public $user;
|
||||
|
||||
public function index()
|
||||
@@ -26,11 +28,18 @@
|
||||
if ($validate) {
|
||||
try {
|
||||
// Save to database
|
||||
// andy add
|
||||
$lastNumberCodeJFK = LpjHelpers::onLastCodeJFK();
|
||||
|
||||
$validate['name'] =strtoupper($request->name);
|
||||
$validate['code'] =$lastNumberCodeJFK;
|
||||
// andy add
|
||||
|
||||
JenisFasilitasKredit::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.jenis-fasilitas-kredit.index')
|
||||
->with('success', 'Jenis Fasilitas Kredit created successfully');
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) {dd($e);
|
||||
return redirect()
|
||||
->route('basicdata.jenis-fasilitas-kredit.create')
|
||||
->with('error', 'Failed to create jenis fasilitas kredit');
|
||||
@@ -57,11 +66,16 @@
|
||||
try {
|
||||
// Update in database
|
||||
$jenisFasilitasKredit = JenisFasilitasKredit::find($id);
|
||||
|
||||
// andy add
|
||||
$validate['name'] =strtoupper($request->name);
|
||||
// andy add
|
||||
|
||||
$jenisFasilitasKredit->update($validate);
|
||||
return redirect()
|
||||
->route('basicdata.jenis-fasilitas-kredit.index')
|
||||
->with('success', 'Jenis Fasilitas Kredit updated successfully');
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) {dd($e);
|
||||
return redirect()
|
||||
->route('basicdata.jenis-fasilitas-kredit.edit', $id)
|
||||
->with('error', 'Failed to update jenis fasilitas kredit');
|
||||
|
||||
Reference in New Issue
Block a user