Merge branch 'issue-28' into 'master'
add activitylog on each models See merge request ldc-web/projets/gen-game-web!26
This commit is contained in:
commit
4223691742
14 changed files with 333 additions and 1 deletions
|
|
@ -15,7 +15,20 @@ use Illuminate\Support\Facades\Schema;
|
|||
* @property array $data Changes.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
*
|
||||
* @property-read \App\Models\User $user User BelongsTo relation.
|
||||
* @property-read \App\Models\User $user User BelongsTo relation.
|
||||
* @property-read \App\Models\StaticPage $staticPage StaticPage BelongsTo relation.
|
||||
* @property-read \App\Models\Settings $settings Settings BelongsTo relation.
|
||||
* @property-read \App\Models\Range $range Range BelongsTo relation.
|
||||
* @property-read \App\Models\Product $product Product BelongsTo relation.
|
||||
* @property-read \App\Models\Prize $prize Prize BelongsTo relation.
|
||||
* @property-read \App\Models\Participation $participation Participation BelongsTo relation.
|
||||
* @property-read \App\Models\InstantWin $instantWin InstantWin BelongsTo relation.
|
||||
* @property-read \App\Models\FaqTheme $faqTheme FaqTheme BelongsTo relation.
|
||||
* @property-read \App\Models\FaqQuestion $faqQuestion FaqQuestion BelongsTo relation.
|
||||
* @property-read \App\Models\Discount $discount Discount BelongsTo relation.
|
||||
* @property-read \App\Models\Customer $customer Customer BelongsTo relation.
|
||||
* @property-read \App\Models\Code $code Code BelongsTo relation.
|
||||
* @property-read \App\Models\BannedIp $bannedIp BannedIp BelongsTo relation.
|
||||
*/
|
||||
class ActivityLog extends Model
|
||||
{
|
||||
|
|
@ -127,4 +140,134 @@ class ActivityLog extends Model
|
|||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* StaticPage BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function staticPage(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StaticPage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function settings(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Settings::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Range BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function range(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Range::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Product BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function product(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prize BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function prize(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Prize::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Participation BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function participation(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Participation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* InstantWin BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function instantWin(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(InstantWin::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* FaqTheme BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function faqTheme(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FaqTheme::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* FaqQuestion BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function faqQuestion(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FaqQuestion::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Discount BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function discount(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Discount::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function customer(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function code(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Code::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* BannedIp BelongsTo relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function bannedIp(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BannedIp::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Casts\Ip;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -11,9 +12,12 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* BannedIp.
|
||||
*
|
||||
* @property integer $ip IP.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class BannedIp extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use IsCachedAsCollection;
|
||||
use HasFactory;
|
||||
|
||||
|
|
@ -53,4 +57,16 @@ class BannedIp extends Model
|
|||
static::updated(fn () => self::removeCached());
|
||||
static::deleted(fn () => self::removeCached());
|
||||
}
|
||||
|
||||
// * RELATIONS
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
|
@ -23,9 +24,13 @@ use Kwaadpepper\Serial\SerialCaster;
|
|||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
|
||||
* Associated participations.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Code extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
|
||||
/**
|
||||
* Indicates if the IDs are auto-incrementing.
|
||||
*
|
||||
|
|
@ -86,6 +91,16 @@ class Code extends Model
|
|||
return $this->hasMany(Participation::class, 'code_unique_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Notifications\Customer\DestroyCustomer;
|
|||
use App\Notifications\Customer\DestroyedCustomer;
|
||||
use App\Notifications\Customer\ResetPassword;
|
||||
use App\Notifications\Customer\VerifyEmail;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Contracts\Database\Query\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
|
@ -32,9 +33,12 @@ use LDC\LDCCRM\Models\Customer as CrmCustomer;
|
|||
* @property \Carbon\Carbon|null $last_connection Date de derniere connexion, (pour les questions oblig CRM).
|
||||
* @property-read \Carbon\Carbon $created_at Created date.
|
||||
* @property-read \Carbon\Carbon $updated_at Updated date.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Customer extends Authenticatable implements MustVerifyEmail
|
||||
{
|
||||
use ActivityLog;
|
||||
use Notifiable;
|
||||
use Prunable;
|
||||
use SoftDeletes;
|
||||
|
|
@ -107,6 +111,16 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
return $this->hasMany(Participation::class, 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
|
|
@ -15,9 +16,13 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
|||
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
|
||||
*
|
||||
* @property-read \App\Models\Participation $participation Associated participation.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Discount extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
||||
/**
|
||||
|
|
@ -29,4 +34,14 @@ class Discount extends Model
|
|||
{
|
||||
return $this->hasOne(Participation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -16,9 +17,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
|
||||
*
|
||||
* @property-read \App\Models\FaqTheme $theme Associated theme.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class FaqQuestion extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use HasFactory;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
|
|
@ -65,4 +69,14 @@ class FaqQuestion extends Model
|
|||
{
|
||||
return $this->belongsTo(FaqTheme::class, 'theme_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -18,9 +19,12 @@ use Illuminate\Validation\ValidationException;
|
|||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\FaqQuestion[] $questions
|
||||
* Associated questions.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class FaqTheme extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use HasFactory;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
|
|
@ -66,4 +70,14 @@ class FaqTheme extends Model
|
|||
{
|
||||
return $this->hasMany(FaqQuestion::class, 'theme_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
|
@ -13,9 +14,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
*
|
||||
* @property-read \App\Models\Prize $prize Associated prize.
|
||||
* @property-read \App\Models\Participation $participation Associated participation.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class InstantWin extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
/**
|
||||
|
|
@ -76,4 +80,14 @@ class InstantWin extends Model
|
|||
{
|
||||
return $this->belongsTo(Participation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||
use App\Casts\Ip;
|
||||
use App\Lib\Helpers\FileStorageHelper;
|
||||
use App\Notifications\Customer\PrizeHasBeenSent;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -31,9 +32,13 @@ use IPLib\Address\AddressInterface;
|
|||
* @property-read \App\Models\Product|null $product Associated product.
|
||||
* @property-read \App\Models\InstantWin $instantWin Associated instantWin.
|
||||
* @property-read \App\Models\Discount|null $discount Associated discount.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Participation extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
|
@ -154,6 +159,16 @@ class Participation extends Model
|
|||
return $this->hasOne(InstantWin::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
|
||||
// * GETTERS
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||
|
||||
use App\Lib\Helpers\FileStorageHelper;
|
||||
use App\Lib\Helpers\ToolboxHelper;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -27,9 +28,12 @@ use Illuminate\Validation\ValidationException;
|
|||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\InstantWin[] $instantWins
|
||||
* Associated instantWins.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Prize extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
/**
|
||||
|
|
@ -119,6 +123,16 @@ class Prize extends Model
|
|||
return $this->hasMany(InstantWin::class, 'prize_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
|
||||
// * CACHE METHOD
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Lib\Helpers\FileStorageHelper;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -23,9 +24,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
* @property-read \App\Models\Range[] $range Associated range.
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
|
||||
* Associated participations.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use HasFactory;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
|
|
@ -103,4 +107,14 @@ class Product extends Model
|
|||
{
|
||||
return $this->hasMany(Participation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Lib\Helpers\FileStorageHelper;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
|
@ -17,9 +18,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Product[] $products
|
||||
* Associated products.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Range extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
|
|
@ -79,4 +83,14 @@ class Range extends Model
|
|||
{
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Casts\AsArrayOfDiscount;
|
|||
use App\Lib\Discount;
|
||||
use App\Lib\Helpers\FileStorageHelper;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use App\Traits\Models\ActivityLog;
|
||||
use Carbon\CarbonInterval;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -44,9 +45,12 @@ use Illuminate\Support\Facades\Cache;
|
|||
* @property-read boolean $game_has_ended Le jeu est terminé ?
|
||||
* @property-read boolean $should_display_teaser_page Doit afficher la page de teaser ?
|
||||
* @property-read boolean $should_display_end_page Doit afficher la page fin de jeu ?
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class Settings extends Model
|
||||
{
|
||||
use ActivityLog;
|
||||
use IsCachedAsCollection;
|
||||
|
||||
/**
|
||||
|
|
@ -254,4 +258,16 @@ class Settings extends Model
|
|||
$this->close_page_active_date->gte(now())
|
||||
);
|
||||
}
|
||||
|
||||
// * RELATIONS
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ use Illuminate\Support\Str;
|
|||
* @property string $content WYSIWYG text content using ckeditor.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
|
||||
*
|
||||
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
|
||||
*/
|
||||
class StaticPage extends Model
|
||||
{
|
||||
|
|
@ -112,4 +114,16 @@ class StaticPage extends Model
|
|||
ToolboxHelper::assertFieldIsUnique($table, 'title', $title, $id);
|
||||
ToolboxHelper::assertFieldIsUnique($table, 'slug', Str::slug($title), $id);
|
||||
}
|
||||
|
||||
// * RELATIONS
|
||||
|
||||
/**
|
||||
* Activities logs One-to-many relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLog::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue