lizeshakya

lizeshakya

Member Since 3 Months Ago

Experience Points 2,520
Experience Level 1

2,480 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 23
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

21 May
3 days ago

lizeshakya left a reply on Eloquent Laravel

In your success.blade.php

You can check whether the session success is set, if it is set you can display it

//success.blade.php
@if(session('success'))
  {{session('success')}}
@endif
16 May
1 week ago

lizeshakya left a reply on Integrity Constraint Violation: 1052 Column 'id' In Where Clause Is Ambiguous

@DESIGN-STUDIO - No removing the groups from groups.id still persist the problem.

lizeshakya started a new conversation Integrity Constraint Violation: 1052 Column 'id' In Where Clause Is Ambiguous

I am building a website where many members can join many groups.

In my User.php model

public function groups()
    {
        return $this->belongsToMany(Group::class, 'group_member', 'member_id', 'group_id');
    }

The function to retrieve related members from the group id

public function getRelatedMembersByGroupIds(array $groupIds)
    {
        $members = User::whereHas('groups', function ($query) use ($groupIds) {
            return $query->whereIn('groups.id', $groupIds);
        });
        return $members->get();
    }

It returns

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select users.* from users where exists (select * from groups inner join group_member on groups.id = group_member.group_id where users.id = group_member.member_id and groups.id in (1) and groups.deleted_at is null and id = 1))

lizeshakya left a reply on Is It Best Practice To Store Role_type In The Session

@JLRDW - Thank you! It worked like a charm.

lizeshakya left a reply on Is It Best Practice To Store Role_type In The Session

@JLRDW - Thank you for the reply,

Yes, I could see the implementation of policy and gates.

But I am unable to find to limit the query based on the role.

Eg: Only super admins can view all the branches. And the employee can view only the current branch he/she is assigned with.

lizeshakya left a reply on Where Are You All From?

Lalitpur, Nepal

lizeshakya started a new conversation Is It Best Practice To Store Role_type In The Session

In my project, I have used Zizaco/entrust package.

I need to check whether the user has a role administrator/super admin/employee?

Since it needs to check for all the pages, I stored it in the session when the user authenticates like:

protected function authenticated(Request $request, $user)
    {
        session(
            [
                'isLoggedIn' => true,
                'isAdministrator' => $user->hasRole('Administrator'),
                'isEmployee' => $user->hasRole('Employee')
            ]
        );
    }

It works like a charm. Is it the best practice since the non-admin users can change the session values. If not, what is the best practice to implement besides querying in all pages?

23 Apr
1 month ago

lizeshakya left a reply on What Is Your Laravel Design Pattern?

@TISUCHI - Thank you @tisuchi for the link. It did help to broad the knowledge of SOLID principle.

lizeshakya left a reply on What Is Your Laravel Design Pattern?

@BRAUNSON - Thank you for the response. Yes I have viewed the solid principles in PHP and it is one of the best series in the Laracasts. Will try to use SOLID wherever it is possible and revisit the SOLID series and this thread when I am unable to :)

lizeshakya started a new conversation What Is Your Laravel Design Pattern?

For me, it is being very difficult to implement SOLID design principle in Laravel application. It gives ache to refactor and implement new feature in the code. How do you achieve SOLID principle in the existing project?