Add new version in repository
This commit is contained in:
@@ -3,18 +3,21 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
use HasRelationships, SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_families';
|
||||
|
||||
public function genres()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function species()
|
||||
@@ -27,9 +30,8 @@ class Family extends Model
|
||||
return $this->hasManyDeep('App\Models\Botanic\Variety', ['App\Models\Botanic\Genre', 'App\Models\Botanic\Specie']);
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,24 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
class Genre extends Model
|
||||
{
|
||||
use SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_genres';
|
||||
|
||||
public function family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function varieties()
|
||||
@@ -24,9 +28,8 @@ class Genre extends Model
|
||||
return $this->hasManyThrough('App\Models\Botanic\Variety', 'App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,35 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
|
||||
class Specie extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_species';
|
||||
use SoftDeletes, Taggable, UserStamps;
|
||||
|
||||
public function Genre()
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_species';
|
||||
|
||||
public function Genre()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Genre');
|
||||
return $this->belongsTo('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function Varieties()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function Articles()
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $this->morphMany('App\Models\Shop\Article', 'product');
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,38 +3,40 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
use Spatie\Image\Manipulations;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
class Variety extends Model implements HasMedia
|
||||
{
|
||||
use EloquentJoin, HasMediaTrait, Taggable;
|
||||
use EloquentJoin, InteractsWithMedia, Taggable, SoftDeletes, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_varieties';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_varieties';
|
||||
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article','product');
|
||||
}
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article', 'product');
|
||||
}
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
public function registerMediaConversions(Media $media = null) : void
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
// $this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user