softwebglobe

softwebglobe

Member Since 7 Months Ago

Experience Points
540
Total
Experience

4,460 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.

Level 1
540 XP
11 Aug
1 month ago

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

Yes my records are correctly formatted, please ignore my omission of the curly braces and comma.

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

Thank you @jirdw for your constant unfruitful response always,

It's strange you keep on posting annoying response, you do not even make any attempt to point me to the right direction, that raises a concern on how you did acquire your badges.

No offence Sir, I said in my question that each record is unique and can either update existing record or perform a fresh insert.

I guess you need to learn how to keep your mouth shut and ignore a discussion you cannot constructively contribute to.

10 Aug
1 month ago

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

Thank you, I forgot to include that, I need solutions

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

Please apply your knowledge of SQL to help solve my problem.

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

So how do I convert the above json array in my question to associative array?

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

Ok, so what solutions do you suggest with a loop

softwebglobe left a reply on Mass Insert And Update Of Over 5 Thousand Array Data

yes Usernames are unique and I do not want a duplicate record. the records are either updated or created every 15 minutes interval.

for such a large records Iam concerned about performance and scalability challenge if I should use loop or is it ok?

softwebglobe started a new conversation Mass Insert And Update Of Over 5 Thousand Array Data

I have more than 5 thousand array data to updateOrCreate in my laravel model.

the challenge is if it's possible to run this update or create command without using foreach or any loop?

The Json array I want to mass update or create is like bellow:

VASHTI: {country: "India", sex: "F", amount: "600", status: 0}
HENRY: {country: "USA", sex: "M", amount: "600", status: 1}
MARRY: {country: "India", sex: "F", amount: "600", status: 0}

Now the array outermost key is the name of the user and I have thousands of this records, my question is how do I mass save and mass update this records in laravel. Using the latest laravel version 5.8.

my user model have the column names:

*username* *country* *sex* *amount* *status*

This records change in bulk so it also requires bulk updateOrCreate

20 Jun
3 months 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
5 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
6 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
7 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.

I just want to retrieve only the full blog posts the user has replied to