Category : laravel-livewire

When using a full page livewire component, is it sufficient to put the authorization in the route, or should you also have authorization in the component class itself? For example I have a route such as this: Route::middleware([‘can:business.create’])->get(‘create’,AppHttpLivewireBusinessCreate::class)->name(‘business.create’); In this route we use the "can:" middlewire to check if the user has the "business.create" permission. ..

Read more

ArgumentCountError: Too few arguments to function AppProvidersBroadcastServiceProvider::{closure}(), 1 passed in D:laragonwwwlaraveljetstreamvendorlaravelframeworksrcIlluminateBroadcastingBroadcastersBroadcaster.php on line 77 and exactly 2 expected in file D:laragonwwwlaraveljetstreamrouteschannels.php on line 21 I am always getting this error . my channels.php Broadcast::channel(‘post{userId}’, function ($data,$userId) { return response()->json([‘user_id’ => $userId,’data’ => $post]); }); Component protected $listeners = [‘echo-private:post.{Auth::user()->id}’ => ‘notifyNewPost’]; I was unable to ..

Read more

I’m facing a strange behavior with entangled variable. Here’s the simplest example possible. In my Livewire component: public $myBoolValue = false; In my blade view: <div class="m-10" x-data="{toggle: @entangle(‘myBoolValue’)}"> <label> <input type="checkbox" @click="toggle = ! toggle"/> </label> <p>Livewire: {{ var_export($myBoolValue) }}</p> <p x-text="[‘Alpine.js: ‘+toggle]"></p> </div> Here’s what happens: After a page refresh, it seems that ..

Read more

i want to trigger hidden input <input id="hidden-input" type="file" wire:model="photos" multiple class="hidden" /> by clicking this button<button id="button" wire:click=".hidden-input" class="mt-2 rounded-sm px-3 py-1 bg-gray-200 hover:bg-gray-300 focus:shadow-outline focus:outline-none"> <i class="fa fa-photo"></i> </button> is there away of doing it in livewire? Sourc..

Read more

I have form submit function which is working just fine in normal controller but since I’ve moved my function to livewire component it returns error Error ErrorException Undefined index: attachment Code Error line commented $chat = new BidChat; // other fields if ($this->attachment) { $attachment = $this->attachment; $filename = ‘chat-attachment’ . ‘-‘ . time() . ..

Read more

I have a table with multiple modals and I am trying to test passing in the row id on the loop to ensure my modal is working properly. But I cannot get the value of the variable to show through my Livewire component. Livewire Component <livewire:dashboard.actions :apt_id="$appointments->id"/> Livewire/dashboard/actions.blade.php <div><button wire:click="showModal">Show modal</button> <x-jet-dialog-modal wire:model="showingModal"> <x-slot name="title"> ..

Read more

I have nested Livewire components, where the "child" fires an event to the "parent". The issue is that it does not reach the listener when firing from the child’s (mount) method. Maybe the listener is not yet available when firing the event from child? It does work when firing from the child’s blade, using wire:click="$emit(…)" ..

Read more

I have a problem with wire:ignore, whenever my function is called with wire:click the result is filtered but the CSS of highlightjs disappears, I cannot understand why the first record is shown correctly, while the following ones are not my view: <div> <livewire:partials.hero /> <section class="section"> <div class="container"> <div class="columns"> <div class="column is-3"> <aside class="is-medium ..

Read more

I’ve want to add filters on my table. My filters are the level of security of an account. There is my HTML <input type="checkbox" value="O" wire:model="level" id="O"> <label for="O">O</label> <input type="checkbox" value="a" wire:model="level" id="a"> <label for="a">A</label> <input type="checkbox" value="b" wire:model="level" id="b"> <label for="b">B</label> <input type="checkbox" value="c" wire:model="level" id="c"> <label for="c">C</label> And there is my Livewire ..

Read more

I tried many ways of populating old checked values in edit page of livewire. Method 1 : public $role_id, $name, $new_permissions = []; public function mount($id) { / $old_permissions = AppModelsUserRolePermission::where(‘user_role_id’, $this->role_id)->pluck(‘permission_id’)->toArray(); // here new_permissions is my wire:model name in view for the checkbox input // so I tried to initialize the new_permissions array by ..

Read more

My name is Cristian, from Argentina, sorry for my english!! I’m trying to work with livewire and i cant get it working. I have a route: Route::middleware([‘auth:sanctum’, ‘verified’]) ->get(‘/nuevoturno’, NuevoTurno::class) ->name(‘nuevoturno’); The NuevoTurno.php contains: namespace AppHttpLivewire; use AppModelsFormatoTurno; use LivewireComponent; class NuevoTurno extends Component { public $qFecha = ‘2020-11-17’; public function render() { return view(‘livewire.nuevo-turno’,[ ..

Read more

Solution at the bottom of the post. My name is Cristian, from Argentina, sorry for my english!! I’m trying to work with livewire and i cant get it working. I have a route: Route::middleware([‘auth:sanctum’, ‘verified’]) ->get(‘/nuevoturno’, NuevoTurno::class) ->name(‘nuevoturno’); The NuevoTurno.php contains: namespace AppHttpLivewire; use AppModelsFormatoTurno; use LivewireComponent; class NuevoTurno extends Component { public $qFecha = ..

Read more

I am using accordion something like this https://www.tailwindtoolbox.com/components/accordion and I have a input field inside my accordion <div class="tab-content overflow-y-scroll border-l-2 bg-gray-100 border-indigo-500 leading-normal"> <div class="border border-black mt-3 p-3 grid grid-cols-4"> <div class="col-span-1"> <label for="about" class="block text-sm leading-5 font-medium text-gray-700"> Title </label> <div class="rounded-md shadow-sm"> <textarea wire:model="additional_docs.title" name="additional_docs" id="edit_additional_docs" name="" rows="3" class="form-textarea mt-1 block w-full ..

Read more