rename models and associates, isolate botanic with shop

This commit is contained in:
Ludovic CANDELLIER
2020-04-21 00:09:32 +02:00
parent c80b0f1edf
commit 4ad1f18310
234 changed files with 13899 additions and 3230 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Family extends Model
{
protected $guarded = ['id'];
protected $table = 'botanic_families';
public function genres()
{
return $this->hasMany('App\Models\Botanic\Genre');
}
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
protected $guarded = ['id'];
protected $table = 'botanic_genres';
public function family()
{
return $this->belongsTo('App\Models\Botanic\Family');
}
public function species()
{
return $this->hasMany('App\Models\Botanic\Specie');
}
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Specie extends Model
{
protected $guarded = ['id'];
protected $table = 'botanic_species';
public function Genre()
{
return $this->belongsTo('App\Models\Botanic\Family');
}
public function Varieties()
{
return $this->hasMany('App\Models\Botanic\Variety');
}
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Variety extends Model
{
protected $guarded = ['id'];
protected $table = 'botanic_varieties';
public function Specie()
{
return $this->belongsTo('App\Models\Botanic\Specie');
}
}