1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 19:44:02 +08:00
course-tencent-cloud/app/Repos/CourseTopic.php
2020-01-30 16:51:10 +08:00

40 lines
858 B
PHP

<?php
namespace App\Repos;
use App\Models\CourseTopic as CourseTopicModel;
class CourseTopic extends Repository
{
public function findCourseTopic($courseId, $topicId)
{
$result = CourseTopicModel::query()
->where('course_id = :course_id:', ['course_id' => $courseId])
->andWhere('topic_id = :topic_id:', ['topic_id' => $topicId])
->execute()
->getFirst();
return $result;
}
public function findByTopicIds($topicIds)
{
$result = CourseTopicModel::query()
->inWhere('topic_id', $topicIds)
->execute();
return $result;
}
public function findByCourseIds($courseIds)
{
$result = CourseTopicModel::query()
->inWhere('course_id', $courseIds)
->execute();
return $result;
}
}