Work on students
This commit is contained in:
parent
faebb04d2c
commit
5debf0f0fa
|
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
|
||||
class Student extends Model
|
||||
{
|
||||
|
|
@ -15,4 +16,9 @@ class Student extends Model
|
|||
return $this->belongsTo(School::class);
|
||||
}
|
||||
|
||||
public function users(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(User::class, School::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
@php use Illuminate\Support\Facades\Auth; @endphp
|
||||
<x-layout.app>
|
||||
<x-slot:page_title>Students</x-slot:page_title>
|
||||
{{ dd(Auth::user()->students) }}
|
||||
</x-layout.app>
|
||||
|
|
|
|||
Loading…
Reference in New Issue