MINI Sh3ll
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Plant extends Model
{
//
use SoftDeletes;
protected $guarded = ['id'];
/**
* Each plant belongs to a company
*/
public function company() {
return $this->belongsTo('App\Models\Company');
}
/**
* Each plant has a country
*/
public function country() {
return $this->belongsTo('App\Models\Country');
}
public function states(){
return $this->belongsTo('App\Models\State','state','id')->select('name');
}
public function user() {
return $this->belongsTo('App\User');
}
public function plant_users() {
return $this->belongsToMany('App\Models\PlantUser', 'plant_users', 'plant_id', 'user_id');
}
public function company_plant_users() {
return $this->hasMany('App\Models\PlantUser');
}
public function treepye() {
return $this->hasOne('App\Models\TreepyePlantDetails','plant_id','id');
}
}
OHA YOOOO