softwebglobe

softwebglobe

Member Since 5 Months Ago

Experience Points 360
Experience Level 1

4,640 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 1
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.

20 Jun
3 weeks ago

softwebglobe left a reply on Vue Router Blank Page Using BeforeEnter

Am having similar issues, i think it happens when you use nested router-view, have not ben able to figure out the real problem

11 Apr
3 months ago

softwebglobe left a reply on VueJS Run Watch Error

@FTIERSCH - okay, what should i do?

softwebglobe started a new conversation VueJS Run Watch Error

Hello everyone please am working on a project that interacts with a third party API, to make the request to the API I can send custom settings in JSON format. My problem is when i add the settings in vue method i get an error on compile, below is my test code and what i tend to achieve.

            requestName() {
                  "settings":  [
                    {
                      "option1": "value1",
                      "option2": "value2"
                    },
                    {
                      "option3": "value3",
                      "option4": "value4"
                    },
                  ],
                  "locale": "en",
            }

when i run watch i get the following error ***Syntax Error: SyntaxError: C:\Users...\path-to-\ComponentName.vue: Unexpected token, expected ";" ***

please help, it gives no error when I do something like below but it gives me invalide settings from the third party API end;

            requestName() {
                let setting =  "settings":  [
                    {
                      "option1": "value1",
                      "option2": "value2"
                    },
                    {
                      "option3": "value3",
                      "option4": "value4"
                    },
                  ],
                  "locale": "en",
            }
21 Feb
4 months ago

softwebglobe left a reply on Laravel Eloquent Relationship

@ROERJO - Thank you nice debug trick

softwebglobe left a reply on Laravel Eloquent Relationship

@ROERJO - sure that was what i was asking about, cause i was experimenting with sql queries to establish the right relation for my eloquent models while am trying to avoid the N + ! query problem.

Thanks again, i have gone through the laravel docs but never found that useful till you pointed me back to the same code block i was scrolling pass in the doc page. Thanks once again. I wish you are a woman will certainly kiss you. LOL

softwebglobe left a reply on Laravel Eloquent Relationship

@ROERJO - Yes you nailed it man. Thank you so much, you just saved me several hours. Can you explain the logic in the closure?

softwebglobe left a reply on Laravel Eloquent Relationship

@BESTMOMO - No sir, the binding is working, when i run below code it works perfect and returns result.

xxxController.php
public function getMyReplies(User $user)
{
return $user; // i get the user info, works fine
return $user->blogpost; //works fine returns me the posts created by the user
return $user->replies; //works fine too, returns the users replies
return $user->blogpost->replies; //which ever relationship comes first returns error when chained together
}

softwebglobe left a reply on Laravel Eloquent Relationship

@CONSTRUCT - Hello sir, thank you for your response. My user, reply and blog models are as shown above in my main question. I tried your solution it did not work, it returned error.

xxxController.php
public function getMyReolies(User $user)
{
return $user->blogpost->replies;
}

running it as above returns error below "message": "Trying to get property 'blogpost' of non-object", or when i interchange the relationship i get "message": "Property [blogpost] does not exist on this collection instance.", exception.

Like i said i just want to grab all the post the user has replied to

softwebglobe left a reply on Laravel Eloquent Relationship

@JAYTHANKI - Am sorry but that did not solve my problem, when i try the above codes it just pulls up random blog post with the reply table been pivote, and also pulling the user info.

I just want to fetch the post that the user has replied to and not the user or his response.

for instance when i run a query with username jeffreyway2019 for instance if he has replied to any blog post i should be able to get all the post he replied to.

20 Feb
4 months ago

softwebglobe left a reply on Laravel Eloquent Relationship

@SERGIU17 - let me try that out

softwebglobe left a reply on Laravel Eloquent Relationship

@SERGIU17 - Thank you but if am not mistaken i guess your code above will just return the authenticated users Blog post, i don't have problem doing this. My question is how do i return all post that the user has replied to. i guess i should be making reference to a pivot reply table

softwebglobe left a reply on Laravel Eloquent Relationship

@JAYTHANKI - yes thank you its an api but when i ran a test using below in my controller

{
    return $user->blogpost()->get();
}

using this as usual returns all the users post but i want the blog that has the users reply

so when i do something like below i get just the

returns all the users replies but i want the post that contains the reply

softwebglobe started a new conversation Laravel Eloquent Relationship

Hello please help me, i have three tables and models

users table blogs table replies table

and the models are as below User model Blog model Reply model

the relationship i have so far are

User.php

public function blogpost()
{
    return $this->belongsTo(Blog::class);
}

public function replies()
{
    return $this->belongsTo(Reply::class)
}

Also my Blog model is as defined below

Blog.php

public function user()
{
    return $this->belongsTo(User::class);
}

public function replies()
{
    return $this->hasMany(Reply::class)
}

and my Reply model is defined as below

Reply.php

public function blogpost()
{
    return $this->belongsTo(Blog::class);
}

public function user()
{
    return $this->belongsTo(User::class)
}

my reply migration has the following table columns

$table->integer('user_id')->unsigned();
$table->integer('blog_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('blog_id')->references('id')->on('blogs')->onDelete('cascade');

Now my question is how do i return all the blogpost which the passed user has replied to. Example user with username Trump77 has replied to several blog posts how do i return this blogs. My user model uses username route binding and id, my blog model uses slug as primary key.

I have been trying it but it keep returning me the blog id, reply id and user