<?php

namespace App\Models;

use App\User;
use App\Models\Categories;
use App\Models\Suppliers;
use App\Models\Status;
use Illuminate\Database\Eloquent\Model;
use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;

class Postulations extends Model
{
    //
    use SpatialTrait;

    protected $fillable = [
        'user_id',
        'category_id',
        'address',
        'int_number',
        'references',
        'appointment',
        'amount',
        'details',
        'status_id',
    ];

    protected $spatialFields = [
        'location',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function categories()
    {
        return $this->belongsTo('App\Models\Categories', 'category_id');
    }


    public function suppliers()
    {
        return $this->hasMany(Suppliers::class);
    }

    public function status()
    {
        return $this->belongsTo(Status::class);
    }
}
