22 lines
597 B
PHP
22 lines
597 B
PHP
<?php namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class FavoriteWordModel extends Model
|
|
{
|
|
protected $table = 'favorite_words';
|
|
protected $primaryKey = 'id';
|
|
protected $allowedFields = ['user_id', 'ew_word_pid', 'created_at'];
|
|
|
|
public function isFavorite($user_id, $ew_word_pid)
|
|
{
|
|
$return=$this->where(['user_id' => $user_id, 'ew_word_pid' => $ew_word_pid])->first();
|
|
return $return;
|
|
}
|
|
|
|
public function removeFavorite($user_id, $ew_word_pid)
|
|
{
|
|
return $this->where(['user_id' => $user_id, 'ew_word_pid' => $ew_word_pid])->delete();
|
|
}
|
|
}
|