samedi 6 mai 2017

How to write a NotMapped entity in Laravel Model?

I am novice in laravel, therefor my question may be odd to someone. Well, my question is how can I write a entity in Laravel Model class which will not be created any field in database after my migration. For example

class JobseekerModel extends Model
{
    use SoftDeletes;
    protected $table='dbl_jobseekers';
    protected $primaryKey='id';
    protected $fillable=[
        'FirstName',
        'MiddleName',
        'LastName',
        'Dob',
        'Education',
        'DesireField',
        'Skill',
        'SpecialSkill',
        'Experience',
        'Location',
        'HomeAddress',
        'Salary',
        'Comenteries',
        'Resume'
    ];
    protected $dates = ['deleted_at'];
}

This is my Model, now I want to add another property named 'PagedListSize' in my Model, however I don't like to create it as a database column. So how do I do this?

For example I am acquainted to use NotMapped property in .Net Framework, which is written like

[NotMapped]
public int PagedListSize {set; get;}

So, how do I able to do this. Is there any way to do this in laravel? i am working on Laravel 5.4



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire