jlrdw

Member Since 5 Years Ago

Experience Points
736,530
Total
Experience

0 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
326
Lessons
Completed
Best Reply Awards
841
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 50
736,530 XP
Apr
16
17 hours ago
Activity icon

Replied to Pure PHP To Laravel Conversion Help

I would say watch some of the laravel 6 from scratch video series and that will give you the understanding of what would be needed.

Use laravel request, and you can use getPdo().

Activity icon

Replied to Should We Use The .env File In Production As Well, And How To Protect It

many users suggest to move the files from the public to the root folder where .env lives

Do not do that, setup like @taylorotwell has in documentation for shared, or one alternative is have main laravel out of public_html, see:

http://novate.co.uk/deploy-laravel-5-on-shared-hosting-from-heart-internet/

If something like digitalocean, they have guides.

Activity icon

Replied to Search Docs (Press '/') Does Nothing - Why?

I just type in a search, i.e. collections, etc. I don't know why he has the slash. But the slash brings you to search if somewhere else in docs.

Try it, scroll all the way down on a docs page, and hit the slash. Works on if cursor is on page somewhere.

Activity icon

Replied to Should We Use The .env File In Production As Well, And How To Protect It

Protect by setting up laravel correctly, pointing to public as document root. You should not be able to view .env from browser.

Example:

yoursite.com/.env

If you get error 404, secure, if you can view in browser, not secure. .env is optional however.

Activity icon

Replied to Trace Insecure State Management

If you do a Google, you can find software and companies that check a site's security.

Activity icon

Replied to Laravel Sanctum: Issue Token Upon POST Authentication

You could just use fetch js to reflect changes, because you said it's working now but with a page refresh.

I guess I don't understand suddenly calling it an API when it's the same data. But there are videos on sanctum that would help you.

Apr
15
1 day ago
Activity icon

Replied to Does Laravel Support Different Types Of Database Systems?

I would suggest browsing over the documentation, because yes it does exist.

Activity icon

Replied to Load Routes From A Service Provider

Somewhere in docs he covers the order of things in the laravel cycle, the boot method may be too early for the route in cycle.

Activity icon

Replied to Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

You could do similar as above and put them into a collection, where there are a bunch of helper methods:

https://laravel.com/docs/8.x/collections

https://laravel.com/docs/8.x/collections#available-methods

Collections are pretty powerful.

Also I'd consider refactoring the array with meaningful key names; ie:

$collection = collect([
    ['product' => 'Desk', 'price' => 200],
    ['product' => 'Chair', 'price' => 100],
]);

Just example.

edit

When you have array's in array's and just numbers for keys you end up with things like having to:

       $s = $this->array_flatten($wordsset[3]);
       echo $s[2][0];

which gives:

chair

If this is an API, you always want consistent nesting in the data. And better key names if possible:

For example from a previous question:

        $currencies = '{
	"USD": {
		"symbol": "$",
		"name": "US Dollar",
		"symbol_native": "$",
		"decimal_digits": 2,
		"rounding": 0,
		"code": "USD",
		"name_plural": "US dollars"
	},
	"EUR": {
		"symbol": "€",
		"name": "Euro",
		"symbol_native": "€",
		"decimal_digits": 2,
		"rounding": 0,
		"code": "EUR",
		"name_plural": "euros"
	},
	"GBP": {
		"symbol": "£",
		"name": "British Pound Sterling",
		"symbol_native": "£",
		"decimal_digits": 2,
		"rounding": 0,
		"code": "GBP",
		"name_plural": "British pounds sterling"
	},
	"INR": {
		"symbol": "Rs",
		"name": "Indian Rupee",
		"symbol_native": "টকা",
		"decimal_digits": 2,
		"rounding": 0,
		"code": "INR",
		"name_plural": "Indian rupees"
	}
}';

See the consistency and names make a big difference.

Having things like:

[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],

instead of

[["3"],["1"],["chair"]],[["4"],["2"],["seat"]],

To me makes it harder to setup loops.

Activity icon

Replied to Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

See example here of how I flatten an array, https://gist.github.com/jimgwhit/cbbe5bb0d2556fdc7e37a86d3630239c

edit:

       $wordsset = [[1],[[["1"],["1"],["scaun"]]],[[["2"],["1"],["stuhl"]]],[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],[[["5"],["la"],["chaise"]]]];
       
       $s = $this->array_flatten($wordsset);
        $keys = array_keys($s);

        for ($i = 0; $i < count($s); $i++) {
            foreach ($s[$keys[$i]] as $key => $value) {
                echo $key . " : " . $value . "<br>";
            }
            echo "-----------------------------------";
            echo "<br>";
        }

Results:

0 : 1
-----------------------------------
0 : 1
-----------------------------------
0 : 1
-----------------------------------
0 : scaun
-----------------------------------
0 : 2
-----------------------------------
0 : 1
-----------------------------------
0 : stuhl
-----------------------------------
0 : 3
-----------------------------------
0 : 1
-----------------------------------
0 : chair
-----------------------------------
0 : 4
-----------------------------------
0 : 2
-----------------------------------
0 : seat
-----------------------------------
0 : 5
-----------------------------------
0 : la
-----------------------------------
0 : chaise
-----------------------------------

Your loop is not set up correctly.

Or for key3

   $s = $this->array_flatten($wordsset[3]);   //here
        $keys = array_keys($s);

        for ($i = 0; $i < count($s); $i++) {
            foreach ($s[$keys[$i]] as $key => $value) {
                echo $value . "<br>";
            }
            echo "-----------------------------------";
            echo "<br>";
        }

Gives:

3
-----------------------------------
1
-----------------------------------
chair
-----------------------------------
4
-----------------------------------
2
-----------------------------------
seat
-----------------------------------
Activity icon

Awarded Best Reply on Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

I even tried:

      $wordsset = [[1],[[["1"],["1"],["scaun"]]],[[["2"],["1"],["stuhl"]]],[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],[[["5"],
       
       echo $wordsset[0][0];
       die;

Which gives:

1

See if it works in blade

{{ $wordsset[0][0] }}

edit, I just tryed and this workded:

       $wordsset = [[1],[[["1"],["1"],["scaun"]]],[[["2"],["1"],["stuhl"]]],[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],[[["5"],["la"],["chaise"]]]];
       
       return view('testarray.atest', compact('wordsset'));

And in view, just a quick setup:

<!DOCTYPE html>
<html lang="en">
    <head>
        
    </head>
    <body>
        {{ $wordsset[0][0] }}
  </body>    
</html>

And got 1.

Make sure you are calling the correct view, works on my end.

Activity icon

Replied to Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

I even tried:

      $wordsset = [[1],[[["1"],["1"],["scaun"]]],[[["2"],["1"],["stuhl"]]],[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],[[["5"],
       
       echo $wordsset[0][0];
       die;

Which gives:

1

See if it works in blade

{{ $wordsset[0][0] }}

edit, I just tryed and this workded:

       $wordsset = [[1],[[["1"],["1"],["scaun"]]],[[["2"],["1"],["stuhl"]]],[[["3"],["1"],["chair"]],[["4"],["2"],["seat"]]],[[["5"],["la"],["chaise"]]]];
       
       return view('testarray.atest', compact('wordsset'));

And in view, just a quick setup:

<!DOCTYPE html>
<html lang="en">
    <head>
        
    </head>
    <body>
        {{ $wordsset[0][0] }}
  </body>    
</html>

And got 1.

Make sure you are calling the correct view, works on my end.

Activity icon

Replied to Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

That array is correct, do you get error before view is loaded, or after?

Or you calling correct view?

Activity icon

Replied to Undefined Array Key 1, ErrorException While Trying To Pass A Variable To View

Where is the error coming from? The array is a correct array. Remember an array is 0 based, starts at 0.

Activity icon

Replied to Laravel Request Is Not Working In Production Model But Work In Local

Check file and class names for case,

Linus is CaSe sensitive:

WIndows Case = case

Linux Case != case.

Activity icon

Replied to How To Change The Dir Of Components Folder?

You can always put in a pull request to have things changed.

Activity icon

Replied to How Save Records On Tables With Parent->child->child Relationship

Give it a try, if that's what's needed. It worked in my case, each child had a load_id column.

Of course queries were distinguished by if it was a pick or a drop for the truck (LTL).

Just a side note, this was back in my Java days not laravel, but query techniques would be similar.

Apr
14
2 days ago
Activity icon

Replied to Laravel8 Errors

Also anything showing in network tab.

Activity icon

Replied to How Save Records On Tables With Parent->child->child Relationship

I once had similar, it's basically a double one to many. In my case I had Loads with children: picks and drops.

Activity icon

Replied to How To Change The Dir Of Components Folder?

DDD has more to do with classes, components are view related. You will have to figure out what vendor classes to extend to make it work.

And this is just my opinion, but you would be better off not moving components so that way you are sticking with laravel conventions.

Activity icon

Replied to How To Change The Dir Of Components Folder?

You may need to override by extending a class. But curious, it's already setup to work, why the change?

Activity icon

Replied to Adding Key/value Pair To Every Array Item

Also if whole array applies to

user_id:1,
problem_id:2,

You could make it like a parent child relation:

user_id:1,
problem_id:2,

=============================================

[
  {
    "user_framework_step_id": 1,
    "user_framework_id": 1,
    "help_text": "Describe the event or situation that is taking place when they run into the problem."
  },
  {
    "user_framework_step_id": 2,
    "user_framework_id": 1,
    "help_text": "What problem or challenge do they run into?"
  },
  {
    "user_framework_step_id": 3,
    "user_framework_id": 1,
    "help_text": "What pain do they experience due to the problem?"
  },
  {
    "user_framework_step_id": 4,
    "user_framework_id": 1,
    "help_text": "Why does the problem happen in the first place?"
  },
  {
    "user_framework_step_id": 5,
    "user_framework_id": 1,
    "help_text": "What future state are they trying to achieve?"
  }
]

Rather that repeat it in every sub array, just a thought:

Activity icon

Replied to How To Make A Scope With A Raw SQL Query?

    public function scopecountPets($query, $petsearch = '')
    {

        if (ChkAuth::userRole('admin') === 'admin') {
            $sql = "SELECT COUNT(petid) as total FROM dc_pets WHERE petname LIKE :sch";
            $params = [':sch' => $petsearch . "%"];
            
        } else {
           $userid = Auth::user()->id;  //Ignore this is custom code
            $sql = "SELECT COUNT(petid) as total FROM dc_pets WHERE petname LIKE :sch AND ownerid = :userid";
           $params = [':sch' => $petsearch . "%", ':userid' => $userid];
        }
        $sth = DB::getPdo()->prepare($sql);
        $sth->execute($params);
        $kount = $sth->fetch(\PDO::FETCH_OBJ);
        return $kount->total;
    }

Just example....

Activity icon

Replied to Intervention Image And FilePond

@www888 so now everything is working? You don't get an error?

Activity icon

Awarded Best Reply on Multiple Models In Contoller

It would really be no different than the conventions that you see in the documentation. As he says in one of his videos name it something that makes sense to you but follow conventions at the same time.

Activity icon

Replied to Multiple Models In Contoller

It would really be no different than the conventions that you see in the documentation. As he says in one of his videos name it something that makes sense to you but follow conventions at the same time.

Apr
13
3 days ago
Activity icon

Replied to Stripe Payment Integration Into Laravel

The back and logic goes hand-in-hand with making the payment through the stripe payment Gateway.

Also, look at laravel spark.

Activity icon

Replied to Stripe Payment Integration Into Laravel

I would also look at some of the videos on payments right here on laracast and look at the documentation as well for cashier which works with stripe.

Activity icon

Awarded Best Reply on Laravel For API

Have a look at laravel Passport. But Sanctum should work, read all of the docs.

Activity icon

Replied to How To Prevent The File From Public On Digital Ocean Space?

You can put images anywhere in the file system, (out of web folders). You can serve them with a script. In public, anyone can view them.

Are you wanting:

  • Anyone to view them
  • Only owner who "owns" them to view them.
Activity icon

Replied to POST Request Works With Postman But Not Guzzle 7

I wonder if this line is working:

'csrf-token' => csrf_token(),

Try setting in header.

Activity icon

Replied to Random "Network Has Changed" Error

Android would not be hardwired, I was referring to a user, in home is using Ethernet and wi-fi at the same time.

But I only re-replied since it was asked.

Activity icon

Replied to Random "Network Has Changed" Error

Also see if users who have trouble are using hardwired and Wi-Fi at the same time.

Activity icon

Replied to Doubts About Stack (Breeze, Bootstrap, Vue, ....)

You usually want to have your Auth when creating the project, unless you are going to follow --

https://laravel.com/docs/8.x/authentication#authenticating-users

Reason, some code and files get over written when you scaffold Auth. As far as stacks, you can use any css and js you want. Laravel does not force anything on you.

I'd say before choosing, browse over the various documentation to help decide.

Also remember, @jeffreyway has many free videos.

Activity icon

Replied to How To Configure Eloqent To Throw Exception On Database Timeout?

After making a config change, did you run:

php artisan config:clear
Activity icon

Replied to Axios

@walker have you figured this out yet?

Activity icon

Replied to Intervention Image And FilePond

But that is your code, I was just pointing out a possible error.

Activity icon

Replied to Why I Can't Play Any Videos In Laracasts ?

This just came up in another discussion, sometimes it depends on which country.

https://laracasts.com/discuss/channels/general-discussion/cannot-open-free-episodes-courses

Apr
12
4 days ago
Activity icon

Replied to Intervention Image And FilePond

This line looks wrong:

$file->move("uploads/" .,$name_gen);     stray dot:

Community Pillar

Earned once your experience points ranks in the top 10 of all Laracasts users.