<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\DB;


class Pendaftar extends Model
{
     /**
     * The database table used by the model.
     *
     * @var string
     */
    use SoftDeletes;
    protected $table = 't_pendaftar';
    protected $dates = ['deleted_at'];
    protected $fillable = ['no_pendaftar','nama','jeniskelamin','tempatlahir','tanggallahir','agama','alamat','kebutuhan_khusus','no_tlp_rumah','user_id'];
    /**
    * The database primary key value.
    *
    * @var string
    */
    protected $primaryKey = 'id';

    public function user(){
        return $this->belongsTo('App\User','user_id');
    }

    public function periodiks(){
        return $this->belongsTo('App\Models\Pendaftar', 'id_pendaftar');
    }

    public function prestasis(){
        return $this->hasMany('App\Models\Prestasis', 'id_pendaftar');
    }
    public function tahunajaran(){
        return $this->belongsTo('App\Models\Tahunajaran', 'thnajaran_id');
    }

   }
