AndySong

AndySong

Member Since 2 Years Ago

China

Experience Points 48,480
Experience Level 10

1,520 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 472
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.

17 Apr
3 months ago
16 Apr
3 months ago

AndySong started a new conversation Maybe A Forum Diffforhumans(time) Bug?

If I create a new thread, when I visit /discuss the subtitle diffforhumans(time) shows correctly, however, when I visit the thread itself page /discuss/channels/general/some-title the diffforhumans(time) does not seem to display correctly. Am I the only one facing this problem?

AndySong started a new conversation Add A Dark Theme To Laracasts?

Add a dark theme to Laracasts?

13 Feb
5 months ago

AndySong left a reply on Query Builder (where And OrderBy)

@STAUDENMEIR - so orderBy can do both derived columns and database columns, whereas where can only access database columns?

AndySong started a new conversation Query Builder (where And OrderBy)

I have a model Thread and Reply, and that is one to many relationship.

so every time I query thread I will have the replyCount with it.

protected static function boot()
    {
        parent::boot();

        static::addGlobalScope('replyCount', function (Builder $builder) {
            $builder->withCount('replies');
        });
    }

so I can do Thread::orderBy('replies_count')->get() no problem.

however when I do Thread::where('replies_count',0)->get() I got the database column not found error.

I am confused that why orderBy did not give me the database column not found error, the where does?

10 Feb
5 months ago

AndySong left a reply on One Confusing Thing About Gates And Policies

@orion oh.... does it mean that laravel wants to give us the ability to override the names? I mean we do not have to use the default method name, if we want to change another name?

AndySong left a reply on One Confusing Thing About Gates And Policies

@ORION - thanks for ur reply, what I was trying to say is that I feel really confused if I have two "names" that do the same thing.

if I register a Policy class, Gate actually has access to all the methods in that class. what's the benefit for defining Gate in [email protected] way.

I think it makes sense when defines it inside a closure. as it's like an anonymous method, we have to give it a name, otherwise, we are not able to resolve it.

AndySong left a reply on One Confusing Thing About Gates And Policies

and if I were to define another gate (using a different name) that points to the same method on policy class, I can use both gates....does this mean that I have two gates that point to the same thing.....

AndySong started a new conversation One Confusing Thing About Gates And Policies

So I was reading the laravel authorization part docs. I am really confused about how to write gates.

I understand that I can define a Gate either using closures or [email protected] style callback string, like controllers. and that is going to call the policy method. and then we call Gate::allows() or Gate::()denies() to check.

However, if I only create a policy class and not to define a Gate in the service provider. I actually still can call Gate::allows() and Gate::()denies() and this still works.

Does this mean Gate::define() is redundant if I only write gates in [email protected] way? or did I missing something in the doc.

Thanks

17 Jan
6 months ago

AndySong left a reply on Screencast Software

@EPARCEL_FI - sorry, I am on Windows. lol

AndySong left a reply on Auth()->user() Does Not Have Methods In User Model(laravel-ide-helper)

@TYKUS - yes, but I really do not like comment/Docs in my code. I try to keep those as less as possible. and it's not very fluent, Thank you for ur help.

AndySong started a new conversation Screencast Software

Can I know what screencast software do u guys know that are good?

Do you have some recommendations?

AndySong left a reply on Auth()->user() Does Not Have Methods In User Model(laravel-ide-helper)

@SNAPEY - I found a workaround, but it is still ideal. but anyway at least it removes the error for phpStrom.

16 Jan
6 months ago

AndySong started a new conversation Auth()->user() Does Not Have Methods In User Model

Hi I have trouble with autocompleting methods in User model when I use auth()->user()

so I have a method foo in User model, and when I use auth()->user() to get the login user instance I do not have the foo method show up.

can some one tell me what congfig I need to do?

17 Dec
7 months ago

AndySong left a reply on Homestead Difference Between Master Branch And The Latest Tag

@D9705996 - Thank u very much, I'll do the same thing too.

14 Dec
7 months ago

AndySong started a new conversation Difference Between Master Branch And The Latest Tag

Hi I am a beginner of homestead just wondering what's the difference between master branch and the latest tag? are they the same?

which means at the moment git checkout v7.20.0 and git checkout master I will have the same thing? which option is the recommended option?

18 Oct
1 year ago

AndySong started a new conversation How Can I Use VUE Component To Highlight Nav Item, If I Selected?(not Tab)

Hi Guys,

I am wondering, How can I use Vue component to highlight the nav item, if I select it? (not tab,different url)

will Vue work? cause apparently every time I click a new url, page get refreshed, so I am so confused how can I achieve that feature.

05 Sep
1 year ago

AndySong left a reply on How To Create More <div> Use Button

@topvillas how to use an array of panels?

AndySong left a reply on How To Create More <div> Use Button

can we use vue way to do it?

AndySong left a reply on How To Create More <div> Use Button

sorry I mean create another div class="panel"

AndySong started a new conversation How To Create More <div> Use Button

Hi all

<div class="panel" v-for="post in posts" v-cloak>
                    <div class="panel-heading">
                        @{{post.title}}
                    </div>
                    <div class="panel-body">
                        @{{post.body}}
                    </div>
                </div>
                <button @click="loadmore" class="bg-info">load more</button>

How can I create another which is class="panel" by click the load more button

AndySong started a new conversation How Can I Use Vue Data In Php File

lets say I have some data in Vue and I want to access it in php files for example routes/web.php

how can I do that

pls

AndySong left a reply on Axios Response Return The Whole Html Rather Than Data

@MaverickChan yes it return all the data. any idea why?

AndySong left a reply on Axios Response Return The Whole Html Rather Than Data

and that is my controller

 public function index()
    {
        $posts=Post::all();
        return view('posts.index',compact('posts'));
    }

and

Route::resource('/posts','PostController');

AndySong started a new conversation Axios Response Return The Whole Html Rather Than Data

Hi I am new to axios and http request, I am trying to have a get request as below

        axios.get('/posts').then(response => console.log(response));

and I have a collection of posts, but on the console I am just getting the whole html. any idea about that?

16 Jun
2 years ago

AndySong started a new conversation How Can I Return Boolean From Sql Result

course_user is a pivot table, How can I know if there is a result that match the condition.

\DB::table('course_user')->where([
            ['course_id', '=', $course->id],
            ['user_id', '=', auth()->id()],
        ])

I mean how can I return it as true or false ! Thanks

AndySong started a new conversation Property * Does Not Exist On This Collection Instance

I am tying to get course info from users by using a pivot table and the relationship is fine, when I did this

public function show(User $user)
    {
        return $user->courses;
    }

it shows [ { "id": 1, "course_id": "90c44fcb-e1b7-33da-9261-0ed5b42c03fe", "course_name": "Wava Oberbrunner", "created_at": "2017-06-16 07:31:06", "updated_at": "2017-06-16 07:31:06", "pivot": { "user_id": "1", "course_id": "1" } } ]

when I did this

    {
        return $user->courses->course_name;

    }

it shows Property [course_name] does not exist on this collection instance.

can anyone tell what is the easiest way to get the course_name ?Pls!

13 Jun
2 years ago

AndySong left a reply on Cannot Stream Laracast Videos

all good for me too, maybe bad network?

12 Jun
2 years ago

AndySong left a reply on What Impacts I Can Get If I Do Not Write Return In A Function

@mikevrind Thanks a lot for explaining me this simple question, I got it!!!

AndySong started a new conversation What Impacts I Can Get If I Do Not Write Return In A Function

Hi I am new to programming, I am just wondering why that in Laravel in some functions I can get the same result whether I write "return" or not, like:

public function store ($channelId, Thread $thread) { return $thread->subscribe(); }

I can get the same result if I remove the "return".

can you guys tell me do I have to write return or it does not really matter?

cheers Andy

31 May
2 years ago

AndySong left a reply on Where Are You All From?

any one from china???