notificaciones migracion y maquetado y modelo
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Bell extends Component
|
||||
{
|
||||
public $noti = 8;
|
||||
public $notificaciones = false;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.bell');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notificacion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'notificaciones';
|
||||
|
||||
protected $fillable = [
|
||||
'remitente_id',
|
||||
'destinatario_id',
|
||||
'titulo',
|
||||
'descripcion',
|
||||
'estado',
|
||||
'todos',
|
||||
];
|
||||
|
||||
public function remitente()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'remitente_id');
|
||||
}
|
||||
|
||||
public function destinatario()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'destinatario_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('pendientes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('historial_id')->nullable();;
|
||||
$table->unsignedBigInteger('servicio_id')->nullable();;
|
||||
$table->unsignedBigInteger('historial_id')->nullable();
|
||||
$table->unsignedBigInteger('servicio_id')->nullable();
|
||||
$table->string('cantidad')->nullable();
|
||||
$table->string('estado')->nullable();
|
||||
$table->foreign('historial_id')->references('id')->on('historiales')->onDelete('cascade');
|
||||
$table->foreign('servicio_id')->references('id')->on('servicios')->onUpdate('cascade');;
|
||||
$table->foreign('servicio_id')->references('id')->on('servicios')->onUpdate('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notificaciones', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('remitente_id')->nullable();
|
||||
$table->unsignedBigInteger('destinatario_id')->nullable();
|
||||
$table->string('titulo')->nullable();
|
||||
$table->text('descripcion')->nullable();
|
||||
$table->boolean('estado')->default(true);
|
||||
$table->boolean('todos')->default(false);
|
||||
|
||||
$table->foreign('remitente_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table->foreign('destinatario_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notificaciones');
|
||||
}
|
||||
};
|
||||
@@ -20,7 +20,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="flex">
|
||||
<livewire:bell />
|
||||
{{-- @livewire('bell') --}}
|
||||
|
||||
|
||||
|
||||
@if ( auth()->user()->rol->nombre != "editor")
|
||||
<div class="space-x-8 sm:ml-8 sm:pr-4 flex text-white font-semibold items-center border-r border-gray-500/40 my-2 mx-1 pr-1" >
|
||||
<div class=" text-sm sm:text-lg ">$ {{number_format(Auth::user()->saldo->valor) ?? '0'}}</div>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="flex justify-center items-center" x-data="{ notificaciones: @entangle('notificaciones') }">
|
||||
<div class="fill-[{{ App\Models\Configuracione::Orderby('id', 'desc')->first()->color_boton }}] relative cursor-pointer"
|
||||
@click="notificaciones=!notificaciones">
|
||||
<span
|
||||
class="absolute top-0 left-0 bg-red-500 rounded-full w-5 h-5 flex justify-center items-center text-xs text-white">
|
||||
{{ $noti > 9 ? '9+' : $noti }}
|
||||
</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" class="w-10">
|
||||
<path
|
||||
d="M200-200q-17 0-28.5-11.5T160-240q0-17 11.5-28.5T200-280h40v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h40q17 0 28.5 11.5T800-240q0 17-11.5 28.5T760-200H200Zm280-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div x-cloak x-show="notificaciones" @click.outside="notificaciones = false" class="absolute top-14 right-32 rounded-lg border border-[{{ App\Models\Configuracione::Orderby('id', 'desc')->first()->color_boton }}] bg-white w-96 h-96 z-50">
|
||||
<div>
|
||||
hola hola
|
||||
hola
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user