notification messages wip

This commit is contained in:
salam committed 2026-01-30 11:08:58 +01:00
1 parent 98d92b2ee3
commit 3ad02457f1
9 files changed
+150 -23

No files matched your search

+4 -2
View File
@@ -2,6 +2,7 @@
namespace App\Actions;
use App\Models\Event;
use App\Models\EventBookmaker;
use App\Models\OddsTable;
@@ -15,10 +16,11 @@ class AlarmStatistic
$fields[$value->name] = explode(',', $value->fieldnames);
}
$event_ids = Event::where('sport_id', auth()->user()->sport_id)->where('starttime', '>=', now())->pluck('id')->toArray();
$res = EventBookmaker::select('alarm_2w_h2w', 'alarm_2w_a2w', 'alarm_2ws1_h2w', 'alarm_2ws1_a2w', 'alarm_3w_h3w', 'alarm_3w_d3w', 'alarm_3w_a3w', 'alarm_3wht_h3w', 'alarm_3wht_d3w', 'alarm_3wht_a3w', 'alarm_dc_dc1x', 'alarm_dc_dc12', 'alarm_dc_dcx2', 'alarm_dbn_dnb1', 'alarm_dbn_dnb2', 'alarm_ggng_gg', 'alarm_ggng_ng', 'alarm_po_home', 'alarm_po_away', 'alarm_poht_home', 'alarm_poht_away', 'alarm_poq1_home', 'alarm_poq1_away', 'alarm_to_over', 'alarm_to_under', 'alarm_toht_over', 'alarm_toht_under', 'alarm_toq1_over', 'alarm_toq1_under', 'alarm_tq_htq', 'alarm_tq_atq')
->where('starttime', '>=', now())
->whereIn('event_id', $event_ids)
->where('bookmaker_id', auth()->user()->bookmaker_id)
->where('sport_id', auth()->user()->sport_id)
->get()
->toArray();
@@ -87,10 +87,6 @@ class EventsTable
EventColumn::make('event'),
IconColumn::make('alarm')->icon('phosphor-sirene'),
IconColumn::make('note')->icon('phosphor-note'),
TooltipOdds::make('ml')->bettype('odds_2ways')->label('')->visible(fn () => in_array('odds_2ways', self::$bettype_settings)),
ColumnOdds::make('odds_2ways')->bettype('odds_2ways')
->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
@@ -513,6 +509,8 @@ class EventsTable
->emptyStateHeading('No events')
->emptyStateDescription('Modify the filter')
->recordActions([
Action::make('note')->iconButton()->icon('phosphor-note')->color('gray')->tooltip('Add a message'),
Action::make('notify')->iconButton()->icon('phosphor-bell')->color('gray')->tooltip('Add a notifications'),
Action::make('star')
->iconButton()
->color(function ($record) {
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
protected $fillable = [
'event_id',
'bookmaker_id',
'user_id',
'message',
'deleted',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserNotification extends Model
{
protected $fillable = [
'event_id',
'bookmaker_id',
'user_id',
'message',
'deleted',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function odds_table()
{
return $this->belongsTo(OddsTable::class);
}
}