%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/camillo/camillo-api-master/app/Models/
Upload File :
Create Path :
Current File : /var/www/html/camillo/camillo-api-master/app/Models/Absence.php

<?php

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;

class Absence extends Model
{

    use ValidatingTrait;

    protected $fillable = [
        'minor_id',
        'classroom_id',
        'date',
        'reason',
        'created_by',
        'updated_by'
    ];

    protected $dates = [
        'created_at',
        'updated_at',
        'date'
    ];

    protected $rules = [
        'date' => 'required|date|unique_with:absences,minor_id,classroom_id',
        'minor_id' => 'required|integer|exists:minors,id',
        'classroom_id' => 'required|integer|exists:classrooms,id',
        'reason' => 'string',
        'user_id' => 'integer|exists:users,id',
    ];

    /**
     * Validation messages to be passed to the validator.
     *
     * @var array
     */
    protected $validationMessages = [
       /* 'minor_id.required' => "",
        'date.required' => "",
        'date.date' => "",
        'created_by.exists' => '',
        'updated_by.exists'*/
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function updater()
    {
        return $this->belongsTo(User::class);
    }

    public function minor()
    {
        return $this->belongsTo(Minor::class);
    }

    public function classroom()
    {
        return $this->belongsTo(Classroom::class);
    }
}

Zerion Mini Shell 1.0