<?php
namespace App\Http\Controllers;
use App\Models\IndikatorOpd;
use Illuminate\Http\Request;
class IndikatorOpd2Controller extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
try {
$indikatorOpd = IndikatorOpd::create($request->all());
return redirect(route('indikator_opd.index'))->with(['success'=>'Berhasil Menambah Data Indikator']);
} catch (\Throwable $th) {
//throw $th;
dd($th->getMessage());
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
$indikatorOpd = IndikatorOpd::where('id', $id)->first();
try {
$indikatorOpd->update($request->all());
return redirect(route('indikator_opd.index'))->with(['success'=>'Berhasil Mengubah Data Indikator']);
} catch (\Throwable $th) {
//throw $th;
dd($th->getMessage());
}
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
$indikatorOpd = IndikatorOpd::where('id', $id)->first();
try {
$indikatorOpd->delete();
return redirect(route('indikator_opd.index'))->with(['success'=>'Berhasil Menghapus Data Indikator']);
} catch (\Throwable $th) {
//throw $th;
dd($th->getMessage());
}
}
public function apiEdit($id){
$indikatorOpd = IndikatorOpd::where('id', $id)->first();
return response()->json([
'status' => 'success',
'data' => $indikatorOpd,
]);
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]