Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Controllers;
- /**
- * by Muhidin Saimin
- * 06/02/2021
- */
- use CodeIgniter\Controller;
- use App\Models\GradeModel;
- class Grade extends Controller
- {
- public function index()
- {
- $model = new GradeModel();
- $data['grades'] = $model->orderBy('name', 'ASC')->findAll();
- return view('grades/index', $data);
- }
- public function add()
- {
- helper(['url', 'form']);
- $model = new GradeModel();
- return view('grades/add');
- }
- public function edit($id)
- {
- helper(['url', 'form']);
- $model = new GradeModel();
- $data['grade'] = $model->find($id);
- return view('grades/edit', $data);
- }
- public function delete($id)
- {
- $model = new GradeModel();
- $model->delete($id);
- session()->setFlashdata('status', 'Kelas berhasil terhapus');
- return redirect()->to(base_url('grade'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement