change icons, css, add routing to merchandise, add mail templater, fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-12 23:34:48 +01:00
parent 8313e25f2e
commit f2f4788ce1
71 changed files with 1486 additions and 154 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Core\Mail;
use App\Repositories\Core\DateTime;
use Illuminate\Database\Eloquent\Model;
class MailLog extends Model
{
protected $guarded = ['id'];
public function scopeByDestination($query, $email)
{
return $query->where('sent_to', $email);
}
public function getCreatedAtAttribute($value)
{
return DateTime::DateTimeToLocale($value);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Core\Mail;
use App\Traits\HasTranslations;
use Spatie\MailTemplates\Models\MailTemplate as parentMailTemplate;
use Venturecraft\Revisionable\RevisionableTrait;
use Wildside\Userstamps\Userstamps;
class MailTemplate extends parentMailTemplate
{
use HasTranslations, RevisionableTrait, Userstamps;
protected $connection = 'central';
public $translatable = ['subject', 'html_template', 'text_template'];
protected $revisionCreationsEnabled = false;
protected $keepRevisionOf = ['subject', 'html_template', 'text_template'];
}

View File

@@ -141,12 +141,12 @@ class Article extends Model implements HasMedia
public function scopeByProduct($query, $model)
{
return $query->where($this->table . '.product_type', $model);
return $model ? $query->where($this->table . '.product_type', $model) : $query;
}
public function scopeByProductId($query, $model_id)
public function scopeByProductId($query, $product_id)
{
return $query->where($this->table . '.product_id', $model_id);
return $product_id ? $query->where($this->table . '.product_id', $product_id) : $query;
}
public function scopeByTag($query, $tag_id)

View File

@@ -25,14 +25,14 @@ class ArticleNature extends Model
return $query->where($this->table . '.id', $id);
}
public function scopeByBotanic($query);
public function scopeByBotanic($query)
{
return $query->where($this->table . '.product_type', 1);
return $query->ByProductType(1);
}
public function scopeByMerchandise($query);
public function scopeByMerchandise($query)
{
return $query->where($this->table . '.product_type', 2);
return $query->ByProductType(2);
}
public function scopeByProductType($query, $type)