google_forms/application/models/Publish_model.php

22 lines
640 B
PHP
Raw Permalink Normal View History

2024-07-16 12:29:59 +00:00
<?php
2024-08-09 12:04:48 +00:00
class Publish_model extends CI_Model
{
// Method to update form details including is_published status
public function update_form($form_id, $data)
{
$this->db->where('id', $form_id);
return $this->db->update('forms', $data);
}
2024-07-16 12:29:59 +00:00
2024-08-09 12:04:48 +00:00
// Method to retrieve published forms by user
public function get_published_forms_by_user($user_id)
{
$this->db->where('user_id', $user_id);
$this->db->where('is_published', 1);
$this->db->order_by('id', 'DESC'); // Order by id column, most recent first
$query = $this->db->get('forms');
return $query->result();
}
2024-07-16 12:29:59 +00:00
}