%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/Communication.php

<?php

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\Model;

class Communication extends Model
{
    public $fillable = [
        'subject',
        'content',
        'is_read',
        'notify',
        'uuid'
    ];

    protected $guarded = [
        'sender_id',
        'receiver_id',
        'minor_id',
        'classroom_id',
        'schoolyear_id',
    ];

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

    protected $rules = [
        'subject' => 'string',
        'content' => 'string',
        'uuid' => 'string',
        'is_read' => 'boolean|required',
        'notify' => 'boolean|required',
        'sender_id' => 'required|exists:users,id',
        'receiver_id' => 'required|exists:users,id',
        'minor_id' => 'required|exists:minors,id',
        'classroom_id' => 'required|exists:classrooms,id',
        'schoolyear_id' => 'required|exists:schoolyears,id',
    ];

    public function sender() {
        return $this->belongsTo(User::class, 'sender_id', 'id');
    }

    public function receiver() {
        return $this->belongsTo(User::class, 'receiver_id', 'id');
    }

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

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

    public function schoolyear() {
        return $this->belongsTo(Schoolyear::class, 'schoolyear_id', 'id');
    }
}

Zerion Mini Shell 1.0