<?php

defined('BASEPATH') or exit('No direct script access allowed');

class Applicant_model extends MY_Model
{

	public function token_search($access_token)
	{
		return $this->db->from('applicant')
			->where('access_token', $access_token)
			->get()->row_array();
	}

	public function create($params)
	{
		$data = [
			'user_id' => $params['user_id'],
			'application_date' => $params['date'],
			'webinar_id' => $params['webinar_id'],
			'access_token' => $params['access_token'],
		];
		$this->db->set('created_at', 'NOW()', false);
		$this->db->set('updated_at', 'NOW()', false);
		$this->db->insert('applicant', $data);
		return $this->db->insert_id();
	}
}
