master crud setup
This commit is contained in:
93
app/Models/Student/Student.php
Normal file
93
app/Models/Student/Student.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use App\Modules\Models\Admission\Admission;
|
||||
use App\Modules\Models\Agent\Agent;
|
||||
use App\Modules\Models\Country\Country;
|
||||
use App\Modules\Models\District\District;
|
||||
use App\Modules\Models\Location\Location;
|
||||
use App\Modules\Models\State\State;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Student extends Model
|
||||
{
|
||||
|
||||
protected $table = 'tbl_students';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'applicant',
|
||||
'first_name',
|
||||
'middle_name',
|
||||
'last_name',
|
||||
'gender',
|
||||
'material_status',
|
||||
'spouse_name',
|
||||
'father_name',
|
||||
'mother_name',
|
||||
'mobile_no',
|
||||
'alternate_mobile_no',
|
||||
'email',
|
||||
'dob',
|
||||
'country_id',
|
||||
'state_id',
|
||||
'source_ref',
|
||||
'ref_id',
|
||||
'district_id',
|
||||
'municipality_name',
|
||||
'ward_no',
|
||||
'intake_year',
|
||||
'intake_month',
|
||||
'village_name',
|
||||
'full_address',
|
||||
'preffered_location',
|
||||
'intrested_for_country',
|
||||
'intrested_course',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function admission(){
|
||||
return $this->belongsTo(Admission::class,'id','student_id');
|
||||
}
|
||||
|
||||
public function educations()
|
||||
{
|
||||
return $this->hasMany(StudentEducation::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function languages()
|
||||
{
|
||||
return $this->hasMany(StudentLanguage::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function fields()
|
||||
{
|
||||
return $this->hasMany(StudentField::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function agent(){
|
||||
return $this->belongsTo(Agent::class,'ref_id','id');
|
||||
}
|
||||
|
||||
public function location(){
|
||||
return $this->belongsTo(Location::class,'ref_id','id');
|
||||
}
|
||||
|
||||
public function student_country(){
|
||||
return $this->belongsTo(Country::class,'country_id','id');
|
||||
}
|
||||
|
||||
public function student_state(){
|
||||
return $this->belongsTo(State::class,'state_id','id');
|
||||
}
|
||||
|
||||
public function student_district(){
|
||||
return $this->belongsTo(District::class,'district_id','id');
|
||||
}
|
||||
|
||||
}
|
37
app/Models/Student/StudentEducation.php
Normal file
37
app/Models/Student/StudentEducation.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentEducation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_student_education';
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'level',
|
||||
'university',
|
||||
'percentage',
|
||||
'documents',
|
||||
];
|
||||
|
||||
public static function getStudents()
|
||||
{
|
||||
// $records = DB::table('candidates')->select('id','first_name','middle_name','last_name','gender','material_status','spouse_name','father_name','mother_name','mobile_no','alternate_mobile_no','email','dob','full_address','status','is_active')->get()->toArray();
|
||||
$records = DB::table('candidates')
|
||||
->join('candidate_passports','candidate_passports.candidate_id','candidates.id')
|
||||
->join('countries','countries.id','candidates.country_id')
|
||||
->join('provinces','provinces.id','candidates.province_id')
|
||||
->join('districts','districts.id','candidates.district_id')
|
||||
->join('districts AS cid','cid.id','candidate_passports.citizenship_issue_district')
|
||||
->select('candidates.id','candidates.first_name','candidates.middle_name','candidates.last_name','candidates.gender','candidates.spouse_name','candidates.father_name','candidates.mother_name','candidates.mobile_no','candidates.alternate_mobile_no','candidates.email','candidates.dob','countries.country_name','provinces.province_name','districts.district_name','candidates.municipality_name','candidates.ward_no','candidates.full_address','candidate_passports.passport_number','candidate_passports.passport_issue_date','candidate_passports.passport_expiry_date','candidate_passports.citizenship_number','candidate_passports.citizenship_issue_date','cid.district_name AS cid_name')
|
||||
->get()
|
||||
->toArray();
|
||||
return $records;
|
||||
}
|
||||
|
||||
|
||||
}
|
16
app/Models/Student/StudentField.php
Normal file
16
app/Models/Student/StudentField.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentField extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'name',
|
||||
];
|
||||
}
|
19
app/Models/Student/StudentLanguage.php
Normal file
19
app/Models/Student/StudentLanguage.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentLanguage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_student_languages';
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'language',
|
||||
'score',
|
||||
'language_documents',
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user