tinfoilman

tinfoilman

Member Since 1 Year Ago

Media, PA

Experience Points
29,460
Total
Experience

540 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
221
Lessons
Completed
Best Reply Awards
8
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 Created with Sketch.

    Community Pillar

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

Level 6
29,460 XP
Aug
18
3 months ago
Activity icon

Awarded Best Reply on Best Place To Store Referral Data

I wouldn't trust anything to be stored in a cookie if you care about it, especially for returning users or users who may use more than one device.

Are you tracking referrals for registered users or all visitors? If only for registered users, I'd definitely store it in a database. If you're tracking every visitor, then it gets a little trickier. I'd probably cache it in Redis and have it expire after a week or whatever seems reasonable.

Aug
07
3 months ago
Activity icon

Awarded Best Reply on How Can I Fix The JQuery-Ajax Request And Response In Laravel?

I always open the developer panel of Google Chrome and see what's actually getting sent. I also use Laravel Telescope, which could also show you, but less conveniently. Just right click on your page an click the "Inspect" menu item, then click on the "Network" tab. Now when you make the AJAX request you'll see the request show up in the "Name" panel, and you can click on that to see what data was being sent, which in turn will tell you if it's the front end or back end that's holding you up.

Activity icon

Replied to How Can I Fix The JQuery-Ajax Request And Response In Laravel?

I always open the developer panel of Google Chrome and see what's actually getting sent. I also use Laravel Telescope, which could also show you, but less conveniently. Just right click on your page an click the "Inspect" menu item, then click on the "Network" tab. Now when you make the AJAX request you'll see the request show up in the "Name" panel, and you can click on that to see what data was being sent, which in turn will tell you if it's the front end or back end that's holding you up.

Activity icon

Replied to Laravel Vistors To My Website

I use a Redis key and store every page view in a set so I can see if it's a new visit or not, and expire the set after a week. Every hour I save all the data to a database for permanent storage and charting.

But honestly, the easiest way is just use Google Analytics, if you don't mine another javascript resource being loaded. Something like half the sites in the world use it and it'll show you more stats than you'll ever care to know.

Aug
05
3 months ago
Activity icon

Replied to What Is The Best Way To Export 1 Million Records

@van1310 how big was the file size when you got it to work in 10 minutes?

We don't know your use case, but it seems like a bad situation to need to export a million records so quickly. You're just not going to be able to write a file that quickly and send it over. It seems to defeat the purpose of using a database in the first place. If you must have data in excel, it would be better if you could just get away with only exporting the records that have changed, then have the end user overwrite the old data with new as needed.

Activity icon

Replied to How To Delete Files On Download Cancellation

This probably won't help you, but if want to use Amazon S3 for your file storage, you can have the downloads folder setup to automatically delete files after a certain time.

Aug
04
3 months ago
Activity icon

Replied to What Is The Best Way To Export 1 Million Records

i try csv file then it take 15 second for 10k records but i want maximum 3 to 5 second to dowload file how to do it

Going from 10 minutes down to 3 to 5 seconds seems unlikely for a million records from a query that has eight joins on it.

Aug
01
4 months ago
Activity icon

Awarded Best Reply on Login With Twitter In Socialite

You may have already done the hard part, but you must make sure your Twitter account is configured correctly. Look here: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials

Jul
31
4 months ago
Activity icon

Replied to Laravel Vapor - Database Connection

I don't understand what you mean by "out-with the handler" but I can tell you that I've been using Vapor for half year and I noticed that it seems to keep RDS connections alive.

When I look at the mySQL tool that I use, I can see that it always has around 50 connections in my use case, even when there's been no traffic on my site.

Activity icon

Replied to WebSocket Is Closed Before The Connection Is Established.

I have no idea if this does anything, but in the bootstrap.js Echo instance of my working app I use enabledTransports: ['ws', 'wss'], where yours says transports: ['websocket'].

Jul
30
4 months ago
Activity icon

Replied to Save Image As Icon Onclick Button.

It's still not clear what you're trying to do. Is there an example you can show?

Activity icon

Replied to Save Image As Icon Onclick Button.

Your question is confusing. What do you mean by "download in icon?"

Are these images downloaded to the computer or do you mean loaded in the web page?

Jul
29
4 months ago
Activity icon

Replied to Login With Twitter In Socialite

You may have already done the hard part, but you must make sure your Twitter account is configured correctly. Look here: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials

Activity icon

Awarded Best Reply on External Redis Host On Forge

I finally figured out what was going on. My AWS redis host was working the whole time!

I did a php artisan cache:clear on my Forge app and saw that everything on my Vapor app was also cleared. Then I did a Redis::keys('*') on Forge to see how I could clear the ElastiCache cluster, but not read anything. That's when I saw that all of the keys were prefixed with APP_NAME_database. I never realized that laravel adds the prefix in config/database.php behind the scenes to avoid collisions between apps. Well in my case, I wanted the 'collision' geez.

Activity icon

Replied to External Redis Host On Forge

I finally figured out what was going on. My AWS redis host was working the whole time!

I did a php artisan cache:clear on my Forge app and saw that everything on my Vapor app was also cleared. Then I did a Redis::keys('*') on Forge to see how I could clear the ElastiCache cluster, but not read anything. That's when I saw that all of the keys were prefixed with APP_NAME_database. I never realized that laravel adds the prefix in config/database.php behind the scenes to avoid collisions between apps. Well in my case, I wanted the 'collision' geez.

Activity icon

Replied to Slow Query When Gettings More Than 1 Data With Ajax Request

Ooh. I got it now. I just remove the with('orders') since I don't actually need it (For now), which causing the query to return extra 1215 rows. So, what I'm doing is running 1,251 (35+1+1,215) rows, which I believe this is still a small amount of data right for 6 seconds? Or is this normal?

Now you lost me. First you said 6 records, then 35 records, and now 1215 rows? There is nothing we can see wrong from the code you showed us, but we don't know what's going on with your orders relationship.

Like others said, you really need to look at what the request is doing. I don't know about Laravel bebugbar, but I use Telescope and it should tell you exactly what queries are being run and how long each takes. That will answer all of your questions!

Jul
28
4 months ago
Activity icon

Replied to Slow Query When Gettings More Than 1 Data With Ajax Request

Is your database running on the local server? Do you know how long the query takes when you don't use ajax? There are way too many variables that could cause a slow down, but obviously 6 seconds means there is a problem somewhere.

Activity icon

Awarded Best Reply on Laravel Response Deleted_at

what is your question? That date in 1969 is like your deleted_at has a value of 0 and you're in a time zone 6 hours behind

Activity icon

Replied to Laravel Response Deleted_at

what is your question? That date in 1969 is like your deleted_at has a value of 0 and you're in a time zone 6 hours behind

Activity icon

Replied to Login With Twitter In Socialite

Well like I said, Twitter will never send you the user's email address until your developer account gets approved, and apparently that process takes weeks. You have no other option.

Activity icon

Replied to External Redis Host On Forge

Thanks for the reply, but I'm sorry I wasn't clear. My issue isn't with the AWS endpoint.

It appears that Forge doesn't look at REDIS_HOST variable. For instance, i could say REDIS_HOST=WTF or anything else and the site still runs like normal with the same cache values! I know it's looking at the environment file because I have the DB_HOST successfully pointed to my AWS RDS instance.

So apparently Forge has some other internal mechanism of using Redis cache by default, and I can't figure it out.

Jul
27
4 months ago
Activity icon

Started a new Conversation External Redis Host On Forge

I'm pretty new to Forge, and I've done some searches on Google and Laracasts but can't seem to find anyone with this same scenario.

I have an existing large application running on Laravel Vapor that has a substantial Redis cache setup with it. I want this little Forge site to access the same Redis cache. I should be able to connect because I put the Forge server on the same VPC as Redis, and configured the security group for access. Basically, it's the same way Vapor connects to it, and it will be darn fast.

The problem is I can't figure out how to get Forge to point the a redis host! I'm able to use redis commands right from the get-go, which is pretty awesome, but what the heck is it connecting it? No matter what I put in my Forge environment file, it still runs off the same redis cache. The default Forge environment file says REDIS_HOST=127.0.0.1, and it seems to mean nothing.

The Forge documentation talks about how to connect to the site's cache externally, but not how to connect Forge to an external host.

Activity icon

Replied to Some Events Aren't Broadcasting Using Vapor + Pusher

Were you able to resolve it? I had an issue several months back with mine. I can't remember what the issue was, but I was getting frustrated with not seeing anything in the logs. The way I eventually figured it out was by putting dd()'s in my code to figure out how far the process was getting, and finally narrowed it down to exact location that was holding it up.

Jul
23
4 months ago
Activity icon

Replied to How To Get Product Data By Id In Laravel Blade

OK, so it looks like all of your cart data is in a serialized field named 'cart' in your Order table? This makes it more difficult since there's no model relationship and you can't eager load the product data.

It's very inefficient to have all of those foreach loops. I'd highly suggest moving all of the cart values into a pivot table and then you can probably cut down all of that code to just a couple lines of code, and more importantly not have to do any data manipulation.

Activity icon

Replied to How To Get Product Data By Id In Laravel Blade

It's as simple as Eager Loading the product data in your controller, assuming you're getting the order data from a database query. Then you can access it in the blade template. Can't really offer any more advice without knowing the details of your code.

Activity icon

Replied to Login With Twitter In Socialite

From what I've heard, Twitter won't give you the user email addresses by default. That means $provider->getEmail() is going to be null. Your error is because the email field is required and you're inserting the null value.

Your two options are to 1) go through the extra hoops to get approved by Twitter to receive the email addresses, or 2) insert your own unique value into the email field. You can do this second way by just using the provider id for an email value because you know it will be unique:

            $user = User::create([
                'name' => $provider->getName(),
                'email' => $provider->getId(),
                'provider_id' => $provider->getId(),
            ]);
Activity icon

Replied to Disable Field

Just curious, why wouldn't you just use a radio button instead of a checkbox? That's what they're meant for.

Jul
22
4 months ago
Activity icon

Replied to How Access From Blade File To Function From Repository?

and I can't use this in controller

Why not? Not only does your blade php code defeat the purpose of Model-View-Controller, it's unnecessarily adding database queries for every iteration of $card. Eager loading in the controller will grab all the plate data in one query!

Jul
21
4 months ago
Activity icon

Replied to How To Diagnose A Slow Site

It actually seems to load fast for me, like a second. When you say VERY slowly, what does that mean? 2 seconds? 5 seconds? 20 seconds? Is the server far from where you live?

Install Laravel Telescope to see exactly how many database queries are being made and how long each one takes, but it doesn't seem like your site is doing much with a database.

Activity icon

Replied to Convert Javascript Code To Php

I don't understand how that could take 5 minutes to load, unless it's being looped over and over with lots of questions. We need more of the code to know what's going on. Also can't really give advice on what to do in a controller without seeing the inputs.

Activity icon

Replied to Running Laravel Dusk With Vapor

Sorry I don't know anything about Dusk, but the Vapor support is contacted by using the little chat icon at the bottom right of the page when you log into https://vapor.laravel.com/app

Activity icon

Replied to What Is Wrong In This -trying To Get Property Name-

What does your query look like in the controller?

It won't work if it returned a collection for the $thread. If so, this would work, though not what you should do:

$thread[0]->user->name
Jul
20
4 months ago
Activity icon

Replied to Best Place To Store Referral Data

I wouldn't trust anything to be stored in a cookie if you care about it, especially for returning users or users who may use more than one device.

Are you tracking referrals for registered users or all visitors? If only for registered users, I'd definitely store it in a database. If you're tracking every visitor, then it gets a little trickier. I'd probably cache it in Redis and have it expire after a week or whatever seems reasonable.

Activity icon

Replied to How Can Get Filename From Intervention Image After Invert

You can make up any filename you want. What is the problem? Are you questioning the line of code:

$filename = time() . '.'. $img->getClientOriginalExtension(); => this not working 

I actually don't even put a file extension on my uploaded files! If you need to, just put 'jpg' there

Activity icon

Replied to My Laravel Application Cant Handle 1000 Users Simultaneously. Site Cant Be Reached Error When Trying To Login Simultaneously

Also, you mentioned that there are a lot of images. I'd definitely serve those from a different server, and ideally some kind of cloud storage. That way your server can put all its resources towards serving pages etc.

Activity icon

Replied to My Laravel Application Cant Handle 1000 Users Simultaneously. Site Cant Be Reached Error When Trying To Login Simultaneously

I'm guessing that you're server is going to see most of its load for only a fraction of its time running. I would seriously look into going serverless instead of spending the money on a dedicated server that still not be able to keep up with so many sessions hitting at the same time. This is truly when something like Laravel Vapor makes sense.

Even if you don't want to go with Vapor, you can still look into mySQL databases with Amazon Web Services. They'll easily handle your queries and the best part is it won't cost much because it'll be running idle most of the time and you can even turn it off when you're not using it. Even an insane mySQL instance with 96 CPUs and 768GB of memory is only $12/hour. But more likely you could do a 16GB one for just 24 cents an hour!

Activity icon

Replied to How To Use Request

This should work

public function nameHere(Request $request)
{
        $solutionId = $request->solutionId;
        $threadId = $request->threadId;
...

But you should be validating your inputs before saving them

Jul
17
4 months ago
Activity icon

Replied to "Some Applications Built In Laravel Might Be Heavier For Faster Loading On Mobile."

Everyone knows heavier applications load faster on mobile. It's conservation of momentum. All that data falling from the cell towers.

Jul
16
4 months ago
Activity icon

Replied to Error When Use Date('Y') Or Now()->year

I see. The code looks ok in the view. Are you sure it's passing in from the controller ok? Try getting rid of the @for loop for a second and see if {{$year}} outputs the year.

Activity icon

Replied to Access Laravel Api From Different Device Localhost

Are you sure there are no firewall settings that are blocking those ports from being accessed remotely?

Activity icon

Replied to Error When Use Date('Y') Or Now()->year

How are you putting it in your view? A javascript script?

<script>document.write(Date().getFullYear())</script>
Activity icon

Replied to Building A Similar Project To Airtasker, Laravel Or WP?

So I just wished you would take a look at that website and just tell me if you think its ever possible to accomplish such thing with WP or what...

Realistically, no, I don't think it's possible to build a site like that with WP. And I agree $2k usd is an underpayment!

Jul
15
4 months ago
Activity icon

Replied to Building A Similar Project To Airtasker, Laravel Or WP?

You're kind of comparing apples to oranges. You can do almost infinitely more with Laravel than you can with WP, but depends on your requirements and how much time/money you have.

In the 60 seconds I spent looking at airtasker on my phone, I'd say you'd be hard pressed to duplicate it on WP. However, do you have experience in Laravel, or have people with experience that will develop it for you? I can build a WP site in a weekend. On the other hand, I've spent 10-20 hours a week for the past 6 months on my own Laravel site and it's maybe 75% complete!

Activity icon

Replied to Create API And Show Data With Laravel From Endpoint

Your subject said to "create API" so I'm not clear what the scope of your project is.

Are you creating the API that holds the list of park data? Or are you creating a site that retrieves the data from another API that already exists?

Activity icon

Replied to Create API And Show Data With Laravel From Endpoint

What exactly is your question?

Activity icon

Replied to Recurring Events With Task

What about using Carbon? You can take the date and add days, or weeks, or months, and it should correct for leap years and all.

Activity icon

Replied to Recurring Events With Task

I see what you're saying now. I was thinking it was an automated task. Sorry.

Activity icon

Replied to Recurring Events With Task

Have you looked into Task Scheduling with Laravel? You shouldn't have to calculate any of those times.

https://laravel.com/docs/7.x/scheduling

Jul
14
4 months ago
Activity icon

Replied to Updating User_id With Permission

That's not passing the route. The problem is before it sees this code.

Activity icon

Replied to No Replies Yet Link Not Listing Threads Properly On Laracasts

That's pretty funny. Now my first page shows 3 threads, the second page shows 1 thread, and the third page on looks normal!