IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class StudentRegistration extends Model {
protected $primaryKey = 'idRegistration';
protected $table = 'student-registration';
protected $fillable = ['remarks', 'registrationNo', 'firstName', 'middleName', 'lastName', 'gender', 'idClass', 'idSection',
'idFinancialYear', 'idClass', 'idSection', 'photo', 'studentDob', 'studentPob', 'gender', 'aadhaarNo', 'religion', 'studentType',
'motherTounge', 'bloodGroup', 'resAddress', 'resCity', 'resPincode', 'landmark', 'resState',
'resTelephone', 'resTelephone', 'lastSchool', 'board', 'percentage', 'lastSchoolAddress', 'lastSchoolCity', 'lastSchoolPhone',
'lastSchoolPincode', 'lastSchoolState', 'reasonForChange', 'contactPerson', 'contactPersonAddress', 'contactPersonRelation', 'contactPersonTel',
'contactPersonMobile', 'food', 'transport', 'learningDisability', 'otherRequirement',
'ralationship_one', 'father_fname', 'father_lname', 'father_dob', 'father_qualification'
, 'father_occupation', 'father_designation', 'father_company', 'father_workloc', 'father_panno', 'father_telephone',
'father_mobile', 'father_aadhaar', 'father_email', 'relationship_two', 'mother_fname', 'mother_lname', 'mother_dob',
'mother_qualification', 'mother_occupation', 'mother_designation', 'mother_company', 'mother_workloc', 'mother_panno',
'mother_telephone', 'mother_mobile', 'mother_aadhaar', 'mother_email','dobwords','lcno','birth_district','birth_state','caste','subcaste','category'
,'categoryCertificate','activities','xerox_docs','birth_certificate','form_type','nationality','marital'];
public function setStudentDobAttribute($date) {
try {
if (strlen($date) > 0)
$this->attributes['studentDob'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['studentDob'] = null;
} catch (\Exception $e) {
$this->attributes['studentDob'] = null;
}
}
public function getStudentDobAttribute($date) {
// dd($date);
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function setDateOfBanAttribute($date) {
if (strlen($date) > 0)
$this->attributes['dateOfBan'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['dateOfBan'] = null;
}
public function getDateOfBanAttribute($date) {
// dd($date);
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function setDeactivationDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['deactivationDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['deactivationDate'] = null;
}
public function getDeactivationDateAttribute($date) {
// dd($date);
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function siblings() {
return $this->hasMany(StudentRegSibling::class, 'idRegistration', 'idRegistration');
}
}
Copyright © 2021 -