<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Siswa extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'nis', 'nisn', 'nopes', 'nama', 'tempat_lahir', 'tanggal_lahir', 'kelas', 'bsk', 'psk', 'kk', 'lulus',
    ];

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

    protected $casts = [
        'tanggal_lahir' => 'datetime:Y-m-d',
        'lulus' => 'boolean',
    ];

    public function accessLog()
    {
        return $this->hasMany('App\AccessLog');
    }

    public function hasilBelajar()
    {
        return $this->hasOne('App\HasilBelajar');
    }

    public function k13HasilBelajar()
    {
        return $this->hasOne('App\K13HasilBelajar');
    }
}
