Test Husky pre-commit hook.

This commit is contained in:
RameshT 2024-08-05 10:11:20 +05:30
parent 75ff32ac2d
commit e827ec7b45
1 changed files with 17 additions and 8 deletions

View File

@ -1,19 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Form extends CI_Controller {
namespace App\Controllers;
public function __construct() {
defined('BASEPATH') or exit('No direct script access allowed');
use App\Models\Form_model;
class Form extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('Form_model');
}
public function submit() {
public function submit()
{
if (!$this->session->userdata('logged_in')) {
// If not logged in, redirect to login page
redirect('users/login');
}
$form_data = json_decode($this->input->raw_input_stream, true);
$this->load->model('Form_model');
if ($this->Form_model->save_form($form_data)) {
$response = array('status' => 'success', 'message' => 'Form submitted successfully.');
@ -24,9 +33,9 @@ class Form extends CI_Controller {
echo json_encode($response);
}
public function view($form_id) {
public function view($form_id)
{
$data['title'] = $this->Form_model->get_form_title($form_id);
if ($data['title'] === null) {
show_404(); // Show 404 if form_id is invalid
}