<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;

class DigitBasedBit extends Model
{
     use Notifiable , SoftDeletes;

 # define table
  protected $table ='digit_based_bit';
  
  # define fillable fields
  protected $fillable = [
  	                   'user_id',
  	                   'bit_id',
  	                   'left_digit',
  	                   'right_digit',
  	                   'amount',
  	                   'status',
                       
  ];

     /**
   * The attributes that should be cast.
   *
   * @var array
   */
  protected $casts = [
      'status'  => 'boolean',
  ];
    public function bit()
    {
       
        return $this->hasOne(new Bit(), 'id', 'bit_id');
    }
     public function username()
    {
       
        return $this->hasOne('App\User', 'id', 'user_id');
    }
}
