thetoad01

thetoad01

Member Since 9 Months Ago

Experience Points 46,450
Experience Level 10

3,550 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 461
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.

19 Aug
4 weeks ago

thetoad01 started a new conversation NGINX No Input File Specified

I am working on a legacy project where I cannot change the paths that use the .php extension. When developing locally and using php artisian serve I can use routes such as:

Route::get('/zipcode/get-zipcode-info.php', 'Zipcodes\[email protected]');

Then the request in my browser: http://127.0.0.1:8000/zipcode/get-zipcode-info.php?zipCode=06111

This works! I was very excited.

Then I deployed the code to our test server and get: "No input file specified."

The test server is running Nginx on Ubuntu 18.04

We have not been able to figure out how to set the config for the virtual host on Nginx to be able to ignore the .php extension and pass it along as a string to the route.

        listen 80;

        root /var/www/html/appdev/public;
        index index.php index.html index.htm;

        server_name appdev.newtechautomotiveservices.com;

        location ~ \.php$ {
                fastcgi_pass unix:/run/php/php7.3-fpm.sock;
                include fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
        }

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
}
04 Jun
3 months ago

thetoad01 left a reply on Filter A Collection By Another Collection

@BOBBYBOUWMANN - I tried the diff methods. Because the keys don't match the results were not what was expected.

thetoad01 left a reply on Filter A Collection By Another Collection

I found a solution. Convert the first collection to an array.

then use the reject method on the collection for everything that is NOT in the array.

$feature_details = $feature_description->reject(function ($value) use ($features) {
    if(!in_array($value->id, $features)) {
        return $value;
    }
});

thetoad01 started a new conversation Filter A Collection By Another Collection

I have a collection of features:

Collection {#608 ▼
  #items: array:15 [▼
    0 => "15"
    1 => "2"
    2 => "9"
    3 => "10"
    4 => "3"
    5 => "11"
    6 => "23"
    7 => "12"
    8 => "5"
    9 => "6"
    10 => "20"
    11 => "13"
    12 => "7"
    13 => "21"
    14 => "8"
  ]
}

and a second collection that is the customer defined descriptions for the features:

[
{
"id": 1,
"store_number": "15212",
"category": "comfort_convenience",
"description": "3rd Row Seats",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-31 16:28:08",
"deleted_by": null
},
{
"id": 2,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Cruise Control",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 3,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Keyless Entry",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 4,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Multi-zone Climate Control",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 5,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Power Locks",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 6,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Power Windows",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 7,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Remote Start",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 8,
"store_number": "15212",
"category": "comfort_convenience",
"description": "Steering Wheel Controls",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 9,
"store_number": "15212",
"category": "luxury",
"description": "Heated Seats",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 10,
"store_number": "15212",
"category": "luxury",
"description": "Heated Steering Wheel",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-31 16:21:31",
"deleted_by": null
},
{
"id": 11,
"store_number": "15212",
"category": "luxury",
"description": "Leather Seats",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 12,
"store_number": "15212",
"category": "luxury",
"description": "Memory Seat",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 13,
"store_number": "15212",
"category": "luxury",
"description": "Premium Wheels",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 14,
"store_number": "15212",
"category": "luxury",
"description": "Sunroof",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 15,
"store_number": "15212",
"category": "entertainment_technology",
"description": "Bluetooth",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 16,
"store_number": "15212",
"category": "entertainment_technology",
"description": "CD Player",
"deleted_at": "2019-05-31 16:39:35",
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-31 16:39:35",
"deleted_by": "1"
},
{
"id": 17,
"store_number": "15212",
"category": "entertainment_technology",
"description": "DVD Player",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-31 16:21:00",
"deleted_by": null
},
{
"id": 18,
"store_number": "15212",
"category": "entertainment_technology",
"description": "Navigation",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 19,
"store_number": "15212",
"category": "entertainment_technology",
"description": "Portable Audio Connection",
"deleted_at": null,
"created_at": "2019-05-29 18:23:42",
"updated_at": "2019-05-29 18:23:42",
"deleted_by": null
},
{
"id": 20,
"store_number": "15212",
"category": "entertainment_technology",
"description": "Premium Audio",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 21,
"store_number": "15212",
"category": "entertainment_technology",
"description": "Security System",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 22,
"store_number": "15212",
"category": "miscellaneous",
"description": "Disability Equipped",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 23,
"store_number": "15212",
"category": "miscellaneous",
"description": "Lift Kit",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 24,
"store_number": "15212",
"category": "miscellaneous",
"description": "Trailer Hitch",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 25,
"store_number": "15212",
"category": "safety",
"description": "Adaptive Cruise Control",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 26,
"store_number": "15212",
"category": "safety",
"description": "Backup Camera",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 27,
"store_number": "15212",
"category": "safety",
"description": "Blind Spot Monitor",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 28,
"store_number": "15212",
"category": "safety",
"description": "Lane Departure Warning",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 29,
"store_number": "15212",
"category": "safety",
"description": "Automatic Emergency Braking",
"deleted_at": null,
"created_at": "2019-05-29 18:23:43",
"updated_at": "2019-05-29 18:23:43",
"deleted_by": null
},
{
"id": 30,
"store_number": "15212",
"category": "miscellaneous",
"description": "Testing #1",
"deleted_at": "2019-05-31 17:59:47",
"created_at": "2019-05-31 17:59:38",
"updated_at": "2019-05-31 17:59:47",
"deleted_by": "1"
}
]

I can't seem to figure out how to filter the second collection based on the first collection.

If there was an "intersectByValues" that works like "intersectByKeys" that would be perfect.

28 Mar
5 months ago

thetoad01 left a reply on Collection Un-nesting GroupBy?

I figured out the answer:

$grouped = $collection->mapToGroups(function ($item, $key) { return [$item['header'] => $item['description']]; });

thetoad01 started a new conversation Collection Un-nesting GroupBy?

Here is a sample of the collection I am returning: { "installed": { "cause": "BaseEquipment" }, "header": "MECHANICAL", "description": "Exhaust, aluminized stainless-steel muffler and tailpipe", "styleId": "301192" }, { "installed": { "cause": "BaseEquipment" }, "header": "EXTERIOR", "description": "Wheel, 17" (43.2 cm) steel spare (spare wheel will not cosmetically match the other 4 wheels)", "styleId": "301192" }, { "installed": { "cause": "BaseEquipment" }, "header": "EXTERIOR", "description": "Spare tire lock keyed cylinder lock that utilizes same key as ignition and door", "styleId": "301192" }, { "installed": { "cause": "BaseEquipment" }, "category": [ "1192" ], "header": "INTERIOR", "description": "Steering wheel, leather-wrapped with theft-deterrent locking feature", "styleId": "301192" }, { "installed": { "cause": "BaseEquipment" }, "header": "INTERIOR", "description": "Instrumentation, analog with speedometer, odometer, fuel level, engine temperature, and tachometer (Includes voltmeter and oil pressure indicators.)", "styleId": "301192" }

I am trying to get the output to look like: { "MECHANICAL": { "Exhaust, aluminized stainless-steel muffler and tailpipe", } "EXTERIOR": { "Wheel, 17" (43.2 cm) steel spare (spare wheel will not cosmetically match the other 4 wheels)", "Spare tire lock keyed cylinder lock that utilizes same key as ignition and door" } "INTERIOR": { "Steering wheel, leather-wrapped with theft-deterrent locking feature", "Instrumentation, analog with speedometer, odometer, fuel level, engine temperature, and tachometer (Includes voltmeter and oil pressure indicators.)",

} }

I have tried every method/combination of methods I can think of and cannot get the output I'm looking for. Any help would be great!

02 Jan
8 months ago

thetoad01 left a reply on Trim All Values In A Collection

Found a solution:

$data = array(); foreach ($records as $header => $value) {

$data[] = array_map('trim', $value);

} dd($data);

using thePhpLeague CSV parser I also had to trim the headers:

$header = array_map('trim', $reader->getHeader());

Thanks to my son for helping me on this one.

thetoad01 left a reply on Trim All Values In A Collection

The $records is a csv file that has been read in-memory (based on http://csv.thephpleague.com/8.0/reading/). In the loop each $record is an array with over 100 elements.

thetoad01 started a new conversation Trim All Values In A Collection

I have an issue where we get a csv file from an external server and parse it into an array. We then turn the array into a collection.

The company that creates the csv has the fields hard coded to a certain length and the data can have spaces at the beginning or end of the field (this is also true in the column headers). I cannot find a base method to trim all values in a collection. Is there any easy way to do this?

Sample of current code: $data = array(); foreach ($records as $offset => $record) { $data[] = $record; }

$collection = collect($data); $json = $collection->toJson();

return $json;