<commit_before><?php

namespace App\Http\Controllers\Api;

use App\Models\Dormitory;
use App\Models\Student;
use App\Transformers\DormitoryInclassTransformer;
use App\Transformers\StudentTransformer;
use Auth;
use App\Repositories\DormitoryRepositoryInterface;

class DormitoriesController extends ApiController
{
    public function availableDormitories()
    {
        $student = Auth::user();
        $dormitories = app(DormitoryRepositoryInterface::class)->getAvailableDormitories($student);
        return $this->response->collection($dormitories, new DormitoryInclassTransformer());
    }

    public function students(Dormitory $dormitory)
    {
        // todo 不同班级的需要显示班级名称
        $studentIds = $dormitory->dormitorySelections->pluck('student_id');
        return $this->response->collection(Student::find($studentIds), new StudentTransformer());
    }
}<commit_msg>添加宿舍号<commit_after><?php

namespace App\Http\Controllers\Api;

use App\Models\Dormitory;
use App\Models\Student;
use App\Transformers\DormitoryInclassTransformer;
use App\Transformers\StudentTransformer;
use Auth;
use App\Repositories\DormitoryRepositoryInterface;

class DormitoriesController extends ApiController
{
    public function availableDormitories()
    {
        $student = Auth::user();
        $dormitories = app(DormitoryRepositoryInterface::class)->getAvailableDormitories($student);
        return $this->response->collection($dormitories, new DormitoryInclassTransformer());
    }

    public function students(Dormitory $dormitory)
    {
        // todo 不同班级的需要显示班级名称
        $studentIds = $dormitory->dormitorySelections->pluck('student_id');
        return $this->response->collection(Student::find($studentIds), new StudentTransformer())
            ->addMeta('dorm_num', $dormitory->dorm_num);
    }
}
{'fraction_non_alphanumeric': 0.11333333333333333, 'fraction_numerical': 0.0, 'mean_word_length': 4.717460317460318, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3515060', 'n_tokens_mistral': 540, 'n_tokens_neox': 551, 'n_words': 86}