mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 04:01:31 +08:00
41 lines
939 B
PHP
41 lines
939 B
PHP
<?php
|
|
|
|
namespace App\Repos;
|
|
|
|
use App\Models\CourseCategory as CourseCategoryModel;
|
|
|
|
class CourseCategory extends Repository
|
|
{
|
|
|
|
public function findCourseCategory($courseId, $categoryId)
|
|
{
|
|
$result = CourseCategoryModel::query()
|
|
->where('course_id = :course_id:', ['course_id' => $courseId])
|
|
->andWhere('category_id = :category_id:', ['category_id' => $categoryId])
|
|
->orderBy('id DESC')
|
|
->execute()
|
|
->getFirst();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function findByCategoryIds($categoryIds)
|
|
{
|
|
$result = CourseCategoryModel::query()
|
|
->inWhere('category_id', $categoryIds)
|
|
->execute();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function findByCourseIds($courseIds)
|
|
{
|
|
$result = CourseCategoryModel::query()
|
|
->inWhere('course_id', $courseIds)
|
|
->execute();
|
|
|
|
return $result;
|
|
}
|
|
|
|
}
|