Naysoewin

Member Since 7 Months Ago

Experience Points
34,010
Total
Experience

990 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
309
Lessons
Completed
Best Reply Awards
0
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 7
34,010 XP
Jan
11
2 weeks ago
Activity icon

Replied to How To Return Multiple RouteKeyName

Hi martinbean,

Thanks for your reply, it's a great solution also , but what about if i want to implement an apiResource route ? Do I need to separate each route or any other options from your advice?

Activity icon

Replied to How To Return Multiple RouteKeyName

Hi Tray2,

Great idea, it works , but I would to understand more if you still have any other similar solution that i can defined without checking request is number or string using is_numeric function. Thanks again

Activity icon

Started a new Conversation How To Return Multiple RouteKeyName

Hello everyone,

Is it possible to return multiple route key name with array? I just want to use both slug and id


public function getRouteKeyName()
    {
        return ['slug', 'id'];
    }

Thanks

Oct
26
2 months ago
Activity icon

Replied to How To Implement Tab Param In Vue Route

Solved !!, Thanks all

Activity icon

Started a new Conversation How To Implement Tab Param In Vue Route

Hello,

I am creating SPA (Laravel + Vue ),

I just would like to know the idea or the way how to implement this small feature that i am expecting, i have done this feature on my pure Laravel blade project but i have no idea how should start on Vue (SPA)

Blade style

@empty ($tab)
@include('profiles.tabs.activities')
@else

@if (view()->exists("profiles.tabs.{$tab}"))
@include("profiles.tabs.{$tab}")
@endif
@endempty

Example : User profile will have many tab like [activities, setting and etc] , when i load user id (12) as below

localhost/users/12?tab=activities

it should render activities component , again if i load setting, it should replace with setting components without repeating others.

If possible and you could help me, please let me know how should i do or an article that i can read

Many Thanks

Oct
13
3 months ago
Activity icon

Replied to Get All Departments From Active Company

Yes , This is exactly what i am expecting, Thank you so much Sinnbeck.

Yes true it will have only one active company.

Activity icon

Replied to Get All Departments From Active Company

Hi, @sinnbeck ,

Thanks for reply, actually, i don't want to fetch via company with eager load . My goal is only want to get departments list from active company only ,

Yes i am hoping to get from one company only.

Thanks again

Activity icon

Started a new Conversation Get All Departments From Active Company

Hello,

Company Model hasMany departments


public function departments() {
        return $this->hasMany(Department::class);
    }

I just want to fetch all of depertments from active company, I think i make something wrong here , please help me check and thanks


public function index()
    {
        $company = Company::where('is_active', true)->get();
        return DepartmentResource::collection($company->departments()->get());
    }
Sep
23
4 months ago
Activity icon

Replied to Push An Object To Laravel Protected $with

Thank you so much Michal,

This both worked,


/**
     * The relationships to always eager-load.
     *
     * @var array
     */
    public function __construct(array $attributes = []) {
        $this->with[] = 'educations';
        
        parent::__construct($attributes);
    }

    /**
     * This method is called upon instantiation of the Eloquent Model.
     * It adds the "seoMeta" field to the "$fillable" array of the model.
     *
     * @return void
     */
    public function initializeHasManyEducation()
    {
        $this->with[] = 'educations';
    }
Activity icon

Started a new Conversation Push An Object To Laravel Protected $with

Hello,

Is it possible to push an object to Laravel eager-load protected $with = [] ?

I have User Model with own protected $with = ['post'] itself

When i use Education Trait in this User Model, I just want to append this object educations to protected $with = [] as below ,



protected $with = ['post', education'];

I tried php `array_push` , but it look like doesn't solve my requirement . Thanks all

                    
Sep
22
4 months ago
Activity icon

Replied to Factory For Model With Custom Namespace In Laravel 8

Hi @evilalex ,

I am also facing the same error , i see you fixed with above link. I am wondering if you could tell me how you fixed it with above link bro?. Thanks

Sep
06
4 months ago
Activity icon

Started a new Conversation Comment System With Parent Id

Hello,

I am try to implement this comment package in my Laravel App,

https://github.com/laravelista/comments

The packages provide to reply parent comment as tree view (child reply comment),

So, Problem here for me is , when user reply comment again and again , it look like as tree view

Like this Screenshoot => https://prnt.sc/ucendz

If possible, can anyone can explain me how can foreach all of child comment under parent comment even user reply child comment. Thanks

Like this Screenshoot => https://prnt.sc/uceoas

Aug
14
5 months ago
Activity icon

Replied to Toggle Local Avatar And Socialite Avatar

WOW,

Really Thanks for your help @bobbybouwmann

Activity icon

Replied to Toggle Local Avatar And Socialite Avatar

Hi @bobbybouwmann ,

Thank you so much ,

it's work for this two condition , (1) if user login with Social and get their image as url (2) If User doesn't have image upload we show default link gravatar.com

But , it doesn't work for if user upload manually via local server because return only avatar_path value like that

src="avatars/TzO3VaW8nSv2Al3Hz5r8J26beilnPACFAdySiDdf.png"

Could you help me check again for me? Thanks again

Aug
13
5 months ago
Activity icon

Started a new Conversation Toggle Local Avatar And Socialite Avatar

Hello,

Before it's working fine , If user doesn't have image upload , show default avatar link as below


    public function getAvatarPathAttribute($avatar)
    {
        return $avatar ? asset('storage/' . $avatar) : 'https://www.gravatar.com/avatar/';
    }

After added socialite package and someone try to login with socialite (ex.github), we request user avatar and insert to avatar_path column with full URL like that

https://avatars3.githubusercontent.com/u/62180549?v=4

So the image doesn't render anymore who login with socialite .

Browser inspect , src Url is like that src="http://localhost:8000/storage/https://avatars3.githubusercontent.com/u/62180549?v=4"

Please let me know how can i toggle it. Thanks

Aug
12
5 months ago
Activity icon

Started a new Conversation Send Notification To Multiple Roles

Hello,

1=> How to send notification to multiple roles when new Post created ? I put role name inside array but it doesn't send out to multiple roles , only send to one role that the first one of array

2=> According to docs, there is two ways to send notification via Trait and via Facade

May i know which one is better to send notification

Thanks all


public function created(Post $post)
    {
        $admin = User::whereHas('roles', function ($q) {
            return $q->whereName(['admin', 'author']);
        })->get();

        /** Using The Notifiable Trait */
        $admin->each(function ($admin) use ($post) {
            $admin->notify(new NewPostSubmitted($post));
        });

        /** Using The Notification Facade */
        Notification::send($admin, new NewPostSubmitted($post));
    }
Aug
06
5 months ago
Activity icon

Replied to Required Confirm Password Before Delete Record

Hi @jlrdw ,

Good Idea and Thanks for sharing

Hi, @bobbybouwmann , Thank you too

Activity icon

Started a new Conversation Required Confirm Password Before Delete Record

Hello,

I allowed user delete itself profile. I just want to add a security layer that user need to enter valid password before delete profile

like github , When we try to delete our repository, we do need to type repository name to delete it

or a link of Article that i can read.

Thanks

Aug
04
5 months ago
Activity icon

Replied to Set Active If Request Is Tab

Thanks again, @silencebringer

Everything solved

Activity icon

Replied to Set Active If Request Is Tab

@silencebringer ,

Thank you so much , it's work for me

One more thing, If url doesn't have any request

ex localhost:8000/username

I have Activities Tag, Setting Tag and Passowrd Change Tag

So i Just want to set a default tag (Activities Tag) as active if there is nothing request in url

Thanks again

Activity icon

Replied to Set Active If Request Is Tab

Hi, @silencebringer ,

Thanks for your helping I clearly understand the code but may be there is some issue because the page stop loading

This page isn’t working127.0.0.1 is currently unable to handle this request.

Could you please help me check again

Activity icon

Replied to Set Active If Request Is Tab

Hi @silencebringer ,

Yes I do want to set active when request()->tab is tab

If url is localhost:800/user?tab=setting set active Setting Tag

else Url is localhost:800/user?tab=change-password

then set active Change Passowrd Tag

Thanks again

Activity icon

Started a new Conversation Set Active If Request Is Tab

Hello ,

I have couple of foreach tabs. When request tab is equal tab , i just want to set active it,

Ex: localhost:800/user?tab=setting

Foreach all of exiting tabs


@isset($tabs)
      @foreach ($tabs as $tab => $action)
           a tag=> class="nav-link {{ set_active('Code Here') }}" href="{{ $action }}">{{ $tab }}
     @endforeach
@endisset

here is helper method is working fine in normal url like localhost:800/user


if (! function_exists('set_active')){
    function set_active($path, $active = 'active') 
    {
        return call_user_func_array('Request::is', (array)$path) ? $active : '';
    }
}

Thanks

Aug
03
5 months ago
Activity icon

Started a new Conversation Prevent Timestamps When Increment View_count

Hello,

Is there anyway to prevent timestamps (updated_at) when the post has increment view_count ?

If i use this in Model ,


public $timestamps = false;

I do need to assign the value every time i updated the post like that


$post->updated_at = Carbon::now();

Thanks