Use MicroKernelTrait to bootstrap application. Rewrote routes, controllers and structure of application a bit. Including use of twig.
This commit is contained in:
@@ -18,7 +18,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
* @property string $variantCode
|
||||
* @property string $modelCode
|
||||
* @property string $url
|
||||
* @property boolean $starred
|
||||
* @property int $starred
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
@@ -30,10 +30,16 @@ class Product extends Model
|
||||
return $this->hasMany(Price::class);
|
||||
}
|
||||
|
||||
public function isStarred(): bool
|
||||
{
|
||||
return (bool) $this->starred;
|
||||
}
|
||||
|
||||
public function currentPrice(): HasOne
|
||||
{
|
||||
return $this->hasOne(Price::class)->latestOfMany('created_at');
|
||||
}
|
||||
|
||||
public function stock(): HasMany
|
||||
{
|
||||
return $this->hasMany(Stock::class);
|
||||
@@ -42,6 +48,7 @@ class Product extends Model
|
||||
public function toggleStarred(): self
|
||||
{
|
||||
$this->starred = !$this->starred;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user