Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
o5t6x7pgljbm
/
public_html
/
admin
/
app
/
Models
/
SchoolManagement
/
Filename :
StudentSegment.php
back
Copy
<?php namespace App\Models\SchoolManagement; use App\Models\School; use App\Models\User; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class StudentSegment extends Model { use HasFactory, SoftDeletes; protected $table = 'student_segments'; protected $fillable = [ 'school_id', 'name', 'description', ]; public function school() { return $this->belongsTo(School::class, 'school_id'); } public function users() { return $this->belongsToMany(User::class, 'student_segment_user', 'student_segment_id', 'user_id') ->using(StudentSegmentUser::class) // Use the custom pivot model ->withTimestamps() ->withPivot('deleted_at'); // Ensure soft deleted records are considered } }