Mithrandir

Mithrandir

CTO at Chainintra / ZiiK

Member Since 2 Years Ago

Copenhagen

Experience Points
166,970
Total
Experience

3,030 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
1579
Lessons
Completed
Best Reply Awards
12
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 34
166,970 XP
Nov
02
1 week ago
Activity icon

Awarded Best Reply on Elasticsearch Prepare Data For Indexing

You already have the product, so why are you fetching it again? And yes, $this->with('branch')->first() will always fetch the same product out of the database.

public function toSearchableArray()
    {
        $this->load('branch');
        $array = $this->toArray();
        //prepare data for geo field
        $array['geo_data'] = $array['branch']['address_latitude'] .','. $array['branch']['address_longitude'] ;

        return $array;
    }

Should probably work

If you still get the error from elasticsearch, you should dump the $array variable and inspect if it makes sense or has too much data.

Sep
30
1 month ago
Activity icon

Replied to Code Coverage

Do you have xdebug installed? Since it complains about a missing code coverage driver, I would look to xdebug on the machine running phpunit

Activity icon

Replied to How To Collect Related Data Through Pivot Table?

What is the complete table schema of branch_user?

Also, I guess the final line is more accurately described as "I want to get a collection of all three workers that belong to branches that User 1 has (= Worker 1+2+3)"

Sep
06
2 months ago
Activity icon

Replied to Eloquent : How To Store Object In Table

If all that is company/contact specific is that it has a type and a reference to another table, it sounds like a morph field - https://laravel.com/docs/5.8/eloquent-relationships#polymorphic-relationships

Aug
19
2 months ago
Activity icon

Replied to How To Use Laravel [webhook] Notification With On-demand Notifications?

What does your routeNotificationForWebhook() method on your notifiable (User? ) class look like?

Jul
22
3 months ago
Activity icon

Replied to Handling Array Validation Failure In Vue

humm... why is the key of the errors "hubs.0", "hubs.1" etc? Is that something you set in the backend?

It would be preferable to get the errors as

{
    message: "The given data was invalid.",
    errors: {
        hubs: [
            "The hubs.0 must be 3 characters.",
            "The hubs.1 must be 3 characters.",
        "The hubs.2 must be 3 characters."
        ]
    }
}

otherwise, feedback['hubs.0'][0], feedback['hubs.1'][0] and feedback ['hubs.2'][0] should work, I think.

Jul
20
3 months ago
Activity icon

Replied to Handling Array Validation Failure In Vue

v-if="feedback.hubs.length" v-for="error in feedback.hubs">{{ error }}
Jul
19
3 months ago
Activity icon

Replied to Transaction Is Rolledback, No Matter What

What happens if you use the transaction() method?

\Illuminate\Support\Facades\DB::transaction(function () {
    $newService = \App\Service::create($service);
    $newQuestionnaire = \App\Questionnaire::create($questionnaire);
});
Jul
17
3 months ago
Activity icon

Replied to How To Change Email In Laravel App?

It could be a config cache as @mstrauss says.

If you are sending emails with a queue worker, also note that once the queue worker is running, it will not update when code changes as it will be in memory. If this is the case, restart the worker process

Jul
16
3 months ago
Activity icon

Replied to Vue.js Vs Angular:

Depends.

Can you be more specific in your question?

Jul
15
3 months ago
Activity icon

Replied to How To Display User Created Blogs Only In Laravel Vuejs

Have you tried

auth('api')->user()->post()->latest()->paginate(20)

On an unrelated note, your relationship on User model should probably be named 'posts' instead of 'post' to show that it is a hasMany relationship.

Activity icon

Replied to Laravel/passport Authentication Problem

Is the token generated on the old server?

Are the oauth keys the same on the new and the old server?

Jul
11
4 months ago
Activity icon

Replied to Using Logging Coverage-clover Is Surprisingly Slow

If you are not using the coverage report, you should not run it - it does take vastly longer than without code coverage reporting since it has to do so much more.

I generally run coverage from the command-line manually, when I want to see the coverage.

I guess you could benefit from only running the coverage in certain cases, where it makes sense, but leave it off for the cases where you simply want to know if the tests pass or fail.

Activity icon

Replied to Elasticsearch Prepare Data For Indexing

You already have the product, so why are you fetching it again? And yes, $this->with('branch')->first() will always fetch the same product out of the database.

public function toSearchableArray()
    {
        $this->load('branch');
        $array = $this->toArray();
        //prepare data for geo field
        $array['geo_data'] = $array['branch']['address_latitude'] .','. $array['branch']['address_longitude'] ;

        return $array;
    }

Should probably work

If you still get the error from elasticsearch, you should dump the $array variable and inspect if it makes sense or has too much data.

Activity icon

Replied to Error While Storing Route ID

What does the route configuration look like?

I am not familiar with Laravel Form api, but if the 'action' is '[email protected]' where is the restaurant in the route URL?

Jul
06
4 months ago
Activity icon

Replied to How To Place Node On Specific Position(left/right) Using Laravel-nestedset

Left or right of what?

As I understand the package, $parent->appendNode($child) will add $child to $parent. If there are existing children, it will be placed at the bottom.

Also, what do you mean by "fetch [...] based on left position"?

Activity icon

Replied to Conceptual Approach To Sockets Security

I think you have the concept correct - a user authenticated with a private channel can see all messages broadcast to that channel.

If you do not want the user - even if authenticated - in a private channel to see the message, you will need to

a) Broadcast the message only on channel(s) that the relevant users can authenticate with

b) Broadcast only non-identifying data - such as an ID - and enough data for the frontend to determine if the broadcast is meant for the current user. If not, do nothing, if yes, query the API for the actual message content (of course, the API should block access to the actual message to users it is not meant for)

If this is not a good reply, please elaborate on your issue(s).

Activity icon

Replied to Nuxt Auth Request With Token Works But Custom Request Fails

'Authorization': app.$auth.getToken('local')

Does the app.$auth.getToken('local') include the "Bearer " prefix? or just the token as raw?

Jul
05
4 months ago