amitshrestha221

Web Developer at Peace Nepal DOT Com

Member Since 4 Years Ago

Bhaktapur, Nepal.

Experience Points
8,910
Total
Experience

1,090 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
12
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 2
8,910 XP
Dec
11
1 month ago
Activity icon

Started a new Conversation Can I Use Livewire In Laravel 5.7?

Can I use Livewire in laravel 5.7?

Dec
04
1 month ago
Activity icon

Replied to Problem With Livewire + Turbolinks SPA

Any solution anyone?

Dec
03
1 month ago
Activity icon

Started a new Conversation Problem With Livewire + Turbolinks SPA

Greetings, I am facing a weird issue. I am working on a SPA with Laravel 8 + LIvewire + Turbolinks framework. The issue doesn't arise in other pages. However in a certain page the following error arises :

Uncaught TypeError: this.components.componentsById[componentId] is undefined
value index.js:29
    <anonymous> proposal line 22694 > injectedScript:3

And after triggering the error, if I go on loading more pages, the error duplicates itself to n number of times. Upon researching, I found out that it is an issue with Turbolinks rather than Livewire i.e. when I disabled turbolinks the error was not arising.

Any solution to this issue would be valuable.

Nov
30
1 month ago
Activity icon

Started a new Conversation Livewire Many Input Fields

I am using Laravel 8 with Livewire. I have a scenario where I have 50+ fields in a form. Do I need to define each wire:model as a public property in the component class or is there any easier method for handling request items?

Nov
18
1 month ago
Activity icon

Replied to Laravel Livewire Checkbox Options Not Being Checked.

Sir, my checkbox values are dynamic. In this case, If i set different names to the wire:model, do I need to define property of each different wire:model name in my component?

Activity icon

Started a new Conversation Laravel Livewire Checkbox Options Not Being Checked.

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 = \App\Models\UserRolePermission::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 old_permissions array
    $this->new_permissions = $old_permissions;
    $this->role_id = $id;
}

Method 2 :

Manually fetched the permissions in the view and checked in_array for the old_permissions to be checked:

@php
    $old_permissions = \App\Models\UserRolePermission::where('user_role_id', $this->role_id)->pluck('permission_id')->toArray();
@endphp
            <div class="col-md-12">
                <div class="form-group">
                    <label class="display-block text-semibold">Select Permissions</label>
                    @foreach($permissions as $item)
                        <label class="checkbox-inline">
                            <input type="checkbox" wire:model="new_permissions" class="" value="{{ $item->id }}" {{ in_array($item->id, $old_permissions) ? "checked" : "" }}>
                            {{ $item->name }} </label>
                    @endforeach
                </div>
            </div>

In the 2nd method, my code in view source was correct, the old ones had checked in input field and the new ones didnt, but in the view the checkboxes didn't appear to be checked.

Nov
06
2 months ago
Activity icon

Awarded Best Reply on SPA On Livewire Not Loading Js Elements After 2nd Page Render

What worked for me was :

I put

document.addEventListener('turbolinks:load', function() {

instead of

document.addEventListener('DOMContentLoaded', function() {

Hope it helps someone in future.

Activity icon

Replied to SPA On Livewire Not Loading Js Elements After 2nd Page Render

What worked for me was :

I put

document.addEventListener('turbolinks:load', function() {

instead of

document.addEventListener('DOMContentLoaded', function() {

Hope it helps someone in future.

Activity icon

Awarded Best Reply on SPA On Livewire Not Loading Js Elements After 2nd Page Render

What worked for me was :

I put

document.addEventListener('turbolinks:load', function() {

instead of

document.addEventListener('DOMContentLoaded', function() {

Hope it helps someone in future.

Activity icon

Replied to SPA On Livewire Not Loading Js Elements After 2nd Page Render

What worked for me was :

I put

document.addEventListener('turbolinks:load', function() {

instead of

document.addEventListener('DOMContentLoaded', function() {

Hope it helps someone in future.

Nov
05
2 months ago
Activity icon

Started a new Conversation SPA On Livewire Not Loading Js Elements After 2nd Page Render

My SPA based on livewire is not loading javascript events after second page rendering:

For example, two cases :

  1. First page refresh in dashboard loads the charts plugin. After I render some other page and come back to dashboard, the chart does not load again.

  2. After I refresh the page, my menus in sidebar are collapsed. After I render some other page, they do not appear collapsed.

I'm using Turbolinks with Livewire on Laravel 8.

Thank you in advance.

Activity icon

Replied to Multiple Live Wire Components In A Blade Page

Just make multiple components and in your app.blade.php

include LW components as @livewire('comp1') @livewire('comp2')

Activity icon

Started a new Conversation SPA On Livewire Not Loading Js Elements After 2nd Page Render

My SPA based on livewire is not loading javascript events after second page rendering:

For example, two cases :

  1. First page refresh in dashboard loads the charts plugin. After I render some other page and come back to dashboard, the chart does not load again.

  2. After I refresh the page, my menus in sidebar are collapsed. After I render some other page, they do not appear collapsed.

I'm using Turbolinks with Livewire on Laravel 8.

Thank you in advance.

Oct
29
2 months ago
Activity icon

Replied to Livewire Group Route By Layout

Yes sir, currently I'm doing the same. I have a lot of components where I will have to manually write that. Is there any way I could control it using route grouping?

Activity icon

Started a new Conversation Livewire Group Route By Layout

Suppose I have 4 different routes. 2 of them are pointing to one layout and another 2 pointing to another layout?

Eg :

Route::get() //pointing to layout backend.app
Route::get() //pointing to layout backend.app

Route::get() //pointing to layout customer.app
Route::get() //pointing to layout customer.app

Currently, I'm defining layout in livewire component manually.

Oct
28
2 months ago
Activity icon

Replied to Laravel 8 Installation

Yes I'm on 7.2. Let me switch to 7.4 and try. Thanks.

Activity icon

Started a new Conversation Laravel 8 Installation

When I hit

composer create-project --prefer-dist laravel/laravel blog

It installs laravel 7.28 instead of 8. What's the reason?

Activity icon

Replied to Regarding Laravel Livewire

It is working now. I hadn't installed the adapter.

Activity icon

Replied to Regarding Laravel Livewire

Sir could you help me little more? I am finding it hard to implement turbolink in Livewire 2.0

my app.blade.php looks like

@livewireStyles

@livewireScripts

// I added this for turbolinks
<script src="https://cdn.jsdelivr.net/gh/livewire/[email protected]/dist/livewire-turbolinks.js" data-turbolinks-eval="false"></script>

                    <a href="dashboard" class="nav-link active">
                        <i class="icon-home4"></i>
                        <span>
								Dashboard
							</span>
                    </a>
                
                    <a href="records" class="nav-link">
                        <i class="icon-home4"></i>
                        <span>
						    Records
                        </span>
                    </a>

And my routes are :

Route::get('dashboard', 'DashboardComponent')->name('dashboard');
Route::get('records', 'Records\RecordsComponent')->name('records');

Both components redirecting to their respective views. The page is still refreshing which means there is something wrong in my process.

For the turbolinks I only added that cdn script. do I need to do something more?

Activity icon

Replied to Regarding Laravel Livewire

@laracoft thank you sir for the support, what exactly I was searching was for turbolinks. I found on Bitfume's tutorial.

Activity icon

Replied to Regarding Laravel Livewire

Sorry sir, I found my issue, I was directly calling the form from my main view rather than creating a separate livewire component and including @livewire('form') in my main view. I thought calling form from same view will work.

However, I have one more question sir, how can i change my views without reloading the page?

Activity icon

Replied to Regarding Laravel Livewire

Its the same result sir, the page reloads and redirects me to :

http://livewire.xyz/?

Activity icon

Replied to Regarding Laravel Livewire

yes sir.. it looks like :

        <form class="login-form" wire:submit.prevent="store">
         			
		// other form components

		
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary btn-block">Sign in <i class="icon-circle-right2 ml-2"></i></button>
                    </div>

                </div>
            </div>
        </form>
Activity icon

Replied to Regarding Laravel Livewire

Oh actually I found my problem. The main problem is my view is not redirecting to component's method.

I have used this in my view :

<form class="login-form" wire:submit.prevent="store">
</form>

and in my LoginComponent I have this method:

public function store(){
    dd(1);
}

Is the form supposed to redirect me to LoginComponent's store() method?

Sorry if I am wrong and for another thread.

Activity icon

Started a new Conversation Livewire Redirect From One Component To Another

How can I redirect from one livewire component to another component's method?

Activity icon

Replied to Regarding Laravel Livewire

Also sir, how can I redirect from one livewire component method to another livewire component method?

Activity icon

Replied to Regarding Laravel Livewire

yes I saw that thank you sir, but can we point specific method of livewire component from route?

Oct
22
2 months ago
Activity icon

Started a new Conversation Regarding Laravel Livewire

I saw few examples of Livewire where the create and update and listing are handled in same page.

Is there any way I can tune it to show listing page and create and update in different page, just to get the benefit of single page application without page refreshing??