CourseApi.php 564 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Http\Api;
  3. use App\Models\CourseMember;
  4. use Illuminate\Support\Facades\Log;
  5. class CourseApi{
  6. public static function getStudentChannels($courseId){
  7. $channels = [];
  8. $studentsChannel = CourseMember::where('course_id',$courseId)
  9. ->whereNotNull('channel_id')
  10. ->select('channel_id')
  11. ->orderBy('created_at')
  12. ->get();
  13. foreach ($studentsChannel as $key => $channel) {
  14. $channels[] = $channel->channel_id;
  15. }
  16. return $channels;
  17. }
  18. }