82 lines
2.0 KiB
PHP
82 lines
2.0 KiB
PHP
<?php namespace App\Controllers;
|
|
|
|
use App\Models\Donation_model;
|
|
|
|
class Home extends BaseController
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
return view('donor_registration');
|
|
}
|
|
|
|
// function validation()
|
|
// {
|
|
// $donation = new Donation();
|
|
// echo $donation->test('7777','9999');
|
|
// }
|
|
|
|
public function store()
|
|
{
|
|
helper(['form', 'url']);
|
|
|
|
$model = new Donation_model();
|
|
|
|
$data = [
|
|
'email' => $this->request->getVar('email'),
|
|
'name' => $this->request->getVar('name'),
|
|
'department' => $this->request->getVar('department'),
|
|
|
|
];
|
|
|
|
$save = $model->insert($data);
|
|
return redirect()->to( base_url('show') );
|
|
}
|
|
|
|
public function edit($id = null)
|
|
{
|
|
$model = new Donation_model();
|
|
$post = $model->find($id);
|
|
$data=['post' => $post,];
|
|
return view('edit_view', $data);
|
|
//return view('edit_view',['firstci4'=>$this->$model->find($id)]);
|
|
}
|
|
|
|
public function update()
|
|
{
|
|
helper(['form', 'url']);
|
|
|
|
$model = new Donation_model();
|
|
|
|
$id = $this->request->getVar('id');
|
|
$data = [
|
|
'name' => $this->request->getVar('name'),
|
|
'email' => $this->request->getVar('email'),
|
|
];
|
|
$save = $model->update($id,$data);
|
|
$donation = new Donation();
|
|
echo $donation->edit_view();
|
|
//return redirect()->to( base_url('users') );
|
|
}
|
|
|
|
public function userDelete($id = null)
|
|
{
|
|
$model = new Donation_model();
|
|
$data['user'] = $model->where('id', $id)->delete();
|
|
$donation = new Donation();
|
|
echo $donation->edit_view();
|
|
// return redirect()->to( base_url('users') );
|
|
}
|
|
public function profile($id = null)
|
|
{
|
|
$model = new Donation_model();
|
|
$post = $model->find($id);
|
|
$data=['post' => $post,];
|
|
return view('profile_view', $data);
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
}
|