OK - blocker message OK - Lorsque tu supprimer la conversation manque suppression de tes messages OK - - afficher liste de course OK - dictionnaire on full mot OK - Commande validé subheader fix OK - Order Toute notifications OK - Utf8Bom csv export accent
40 lines
777 B
PHP
40 lines
777 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\NiceDate;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class Message extends Model
|
|
{
|
|
|
|
protected $casts = [
|
|
'created_at' => NiceDate::class,
|
|
];
|
|
|
|
protected $fillable = [
|
|
'message',
|
|
'to'
|
|
];
|
|
|
|
public function toCustomer()
|
|
{
|
|
return $this->belongsTo(Customers::class, 'to');
|
|
}
|
|
|
|
public function fromCustomer()
|
|
{
|
|
return $this->belongsTo(Customers::class, 'from');
|
|
}
|
|
|
|
public static function getMessagesOlderThan(int $days)
|
|
{
|
|
return Message::where('updated_at', '<', Carbon::now()->subDays($days));
|
|
}
|
|
|
|
public function notifiable()
|
|
{
|
|
return $this->morphOne(Notifications::class, 'notifiable');
|
|
}
|
|
}
|