Category : laravel-livewire

I’ve problem on refreshing model collection after detach on Laravel livewire. I want to remove detached item from view without refresh full page, but it seem not work. it need to refresh full page to re render the view. I have tried to $model->refresh() after detach(), and its work but $model->refresh() duplicate already loaded relationship ..

Read more

I am trying to implement Logout functionality on my Laravel app with TALL stack, I am firing logout event from my blade via Livewire wire:click but it doesn’t seem to fire any method from its own component. Loading my component in app.blade.php layout: <li class="flex"> @livewire(‘logout’) </li> logout.blade.php <a wire:click="logout" class="some-classes" > <svg class="w-4 h-4 ..

Read more

I’d like to be able to get the errorBag from a livewire component within JS after receiving the message.processed hook. Unfortunately, the errorBag is protected so I’m a bit stuck. Does anyone know how it can be done? This is as far as I’ve got Livewire.hook("message.processed", (message, component) => { let comp = Livewire.find(component.el.getAttribute("wire:id")) console.log(comp.get(‘errorBag’)) ..

Read more

I am trying to trigger a livewire function from a wire:click in a datatables array. This system works fine but only for the first datatable page. Nothing is triggered in the 2nd page or higher. Here is my code : event.php : public function showEvent($eventId) { return redirect()->route(‘events.show’, [$eventId]); } event.blade.php : <table class="table align-items-center ..

Read more

Hye, i need help with foreign keys during form submission. it seems like the fk is not working, the id is not copy and paste in the table that has fk this is my adds.php <?php namespace AppHttpLivewire; use LivewireComponent; use AppCustomer; use AppOrder; use AppTransaction; use AppWireTransfer; class Adds extends Component { public $transactDate; ..

Read more

I’m trying to paginate items in a livewire component, I have this query public $franchiseList; public function getFranchises($coords) { if ($coords) { $latitude = json_decode($coords)[0]; $longitude = json_decode($coords)[1]; $radiusInMeters = 800; $this->franchiseList = Franchise::select(DB::raw(‘*, ( 6371000 * acos( cos( radians(‘ . $latitude . ‘) ) * cos( radians( latitude ) ) * cos( radians( longitude ..

Read more

I have a method scoup scopeCalculateMaxPositionSelectedCategory in my Model Category class Category extends Model { use HasFactory; protected $fillable = [ ‘parent_id’, ‘name’, ‘slug’, ‘description’, ‘position’, ‘quantity_available_offers’, ]; public function scopeCalculateMaxPositionSelectedCategory($query, $cat_id = null) { return $query->where(‘parent_id’, $cat_id)->max(‘position’); } } When i call like that it’s work fine: Category::CalculateMaxPositionSelectedCategory(); But i want do this that ..

Read more

i’m trying to build a polls system using livewire but i got some errors here is my blade @foreach ($questions as $index => $question) <div class="row"> <div class="box-header with-border"> <i class="fa fa-question-circle text-black fs-20 me-10"></i> <h4 class="box-title">{{ $question->title }}</h4> </div> <div class="box-body"> <div class="demo-radio-button"> @foreach ($answers as $key => $answer) <input wire:model="question{{ $question->id }}" type="radio" ..

Read more

I want to show customer data in a bootstrap popover. I am using livewire datatable to show customers. when click customer user name I want to show a popover with customer details. this is the table which I show user name user name get by this code <div> <a title=”simulate” data-html=”true” data-container=”body” data-toggle=”popover” data-placement=”bottom” href=”javascript:void(0);” ..

Read more

i am using livewire , laravel 7. Below is the code. How to make sure the input is readonly when the value is empty? <div class="col-md-3 mb-3"> <label class="form-control-label" >Quantity*opt</label> @if ( $quantity === null) <input type="text" name="" value="" wire:model="serviceOrder.{{ $loop->index }}.quantity" class="form-control" readonly > @else <input type="text" name="" value="" wire:model="serviceOrder.{{ $loop->index }}.quantity" class="form-control" > ..

Read more

I am changing rule property in mount method. but when i again using rules in other method its not maintaining state. createAccount method is called from button using wire:click. class CreateUsers extends Component { use PasswordValidationRules; public User $user; protected $rules = [ ‘user.name’ => [‘required’, ‘string’, ‘max:255’], ‘user.username’ => [‘required’, ‘string’, ‘max:255’], ‘user.confirm_password’ => ..

Read more

after i added livewire using composer require livewire/livewire and creating new livewire component using php artisan make:livewire search I keep getting an error Undefined type ‘LivewireComponent’ <?php namespace AppHttpLivewire; use LivewireComponent; class Search extends Component { public function render() { return view(‘livewire.search’); } } ?> Can you help me please what am i doing wrong ..

Read more