lizeshakya

lizeshakya

Member Since 8 Months Ago

Experience Points
3,090
Total
Experience

1,910 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
27
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

Level 1
3,090 XP
Jul
16
2 months ago
Activity icon

Replied to Laravel File Manager Rename Feature

Yes, it helps.

Only one problem is, admin can rename any image name. It is impossible for me to track whether the image is associated with the database

Activity icon

Started a new conversation Laravel File Manager Rename Feature

Hello everyone,

I am using "unisharp/laravel-filemanager": "v2.0.0-alpha8", package for maintaining images.

For storing the image of the user, I have created a picture_url column in the users table.

Let us suppose User with id 1 has picture_url of /storage/filesystem/bin/images/users/5d2df110cbbc4.jpg.

The problem is when one of the admin renames it from

/storage/filesystem/bin/images/users/5d2df110cbbc4.jpg to /storage/filesystem/bin/images/users/5d2df110cbd51.jpg

the name of the image. How do I reflect the changes to the save picture_url of the user? Is there any way to reflect the changes to the user? Is there any way to hide the rename feature?

Jun
07
4 months ago
Activity icon

Replied to How To Reflect Laravel Delete Observer For The Model Collection?

@JOHNBRAUN - Thank you for your reply. No, still not working. After using first(), it only deleted the first sub Task. I need to delete all subtasks having parent_id $task->id.

Activity icon

Started a new conversation How To Reflect Laravel Delete Observer For The Model Collection?

Hello everyone,

I have a TaskObserver class which records the activities.

When I try to delete the task using ::find() function,

$task = Task::find($id);
$task->delete();

It gets reflected in the Task delete observer.

When I try to delete collection using

$task = Task::find($id);
$subTasks = Task::where('parent_id', $task->id)->delete();

It does not reflects the delete observer for any subtasks.

Yes, I searched and found https://github.com/laravel/framework/issues/11777#issuecomment-170388067. It tells to use ::find() method so it reflects in the observer.

Do I have to loop through all subtasks and use ::find() method?

$subTasksId = Task::where('parent_id', $task->id)->pluck('id');
 foreach($subTasksId as $subTaskId){
    $deleteSubTask = Task::find($subTask)->delete();
}
May
21
4 months ago
Activity icon

Replied to 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
May
16
4 months ago
Activity icon

Replied to Integrity Constraint Violation: 1052 Column 'id' In Where Clause Is Ambiguous

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

Activity icon

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))

Activity icon

Replied to Is It Best Practice To Store Role_type In The Session

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

Activity icon

Replied to 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.

Activity icon

Replied to Where Are You All From?

Lalitpur, Nepal

Activity icon

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?

Apr
23
5 months ago
Activity icon

Replied to What Is Your Laravel Design Pattern?

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

Activity icon

Replied to 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 :)

Activity icon

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?