mohamedali5738
how to make sound with notification database in filament
this is my code "
@php
$notificationss = DB::table('notifications')->get();
@endphp
@if(count($notificationss) >=1 )
<script>
function playNotificationSound() {
const audio = new Audio('/sounds/notification.wav');
audio.play();
}
</script>
<div class="notification"> <script> playNotificationSound(); setInterval(() => { playNotificationSound() }, 10000); </script> </div> @endif" how to inject this code in filament ?
</script>
<div class="notification"> <script> playNotificationSound(); setInterval(() => { playNotificationSound() }, 10000); </script> </div> @endif" how to inject this code in filament ?
3 replies
this error show me when delete record this error show me when delete record
getAttributeAndLocale(): Argument #1 ($key) must be of type string, null given in astrotomic\laravel-translatable
i thank proble is here " public static function getRecordTitle(?Model $record): string | Htmlable | null
{
return $record?->getAttribute(static::getRecordTitleAttribute()) ?? static::getModelLabel();
}" because i am using multi lang and when delete , it doesnot show title of record trans
3 replies
Add [name] to fillable property to allow mass assignment on [App\Models\Country].
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
use Astrotomic\Translatable\Translatable;
class Country extends Model implements TranslatableContract
{
use HasFactory;
use Translatable;
protected $with = ['translations'];
public $translatedAttributes = ['name'];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CountryTranslation extends Model
{
use HasFactory;
protected $fillable = [
'name','locale' ,'country_id',
];
public $timestamps = false;
}
2 replies