Guest User

postition model

a guest
Jan 21st, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Models;
  4.  
  5. use Illuminate\Database\Eloquent\Factories\HasFactory;
  6. use Illuminate\Database\Eloquent\Model;
  7. use \DateTimeInterface;
  8.  
  9. class Position extends Model
  10. {
  11.     use HasFactory;
  12.  
  13.     public $table = 'positions';
  14.  
  15.     protected $dates = [
  16.         'created_at',
  17.         'updated_at',
  18.         'deleted_at',
  19.     ];
  20.  
  21.     protected $fillable = [
  22.         'position',
  23.         'banner_id',
  24.         'created_at',
  25.         'updated_at',
  26.         'deleted_at',
  27.     ];
  28.  
  29.     protected function serializeDate(DateTimeInterface $date)
  30.     {
  31.         return $date->format('Y-m-d H:i:s');
  32.     }
  33.  
  34.     public function banner()
  35.     {
  36.         return $this->belongsTo(Banner::class, 'banner_id');
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment