fylzero

Member Since 6 Years Ago

Chicago, IL

Experience Points
281,350
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
1864
Lessons
Completed
Best Reply Awards
134
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
281,350 XP
Jan
18
18 hours ago
Activity icon

Replied to Constrain Query By Relation's Timezone?

@joshp There is whereHas but it wouldn't help in this case since what you'd want is to make a comparison based on the data it is looking up.

What you're doing actually doesn't sound horribly inefficient, at least you are having PHP crunch the data instead of writing a bad N+1 query. You are also slimming down the data set based on customer_id so it isn't really that bad imo.

Activity icon

Replied to Location Of Email Verification Handler Route

@alexolival I would think it should be in web, since that's where laravel/ui etc typically put such things. The difference is the middleware applied and api is prepended with /api.

You can get a sense of the difference in app/Providers/RouteServiceProvider.php

Activity icon

Replied to Bootstrap Tab And Search Bar

@evooms123 You can use Javascript to open the tab once your search result is successful.

https://getbootstrap.com/docs/4.5/components/navs/#tabshow

Activity icon

Replied to Create Method Not Inserting Data Into DB

@base8innovations Just asking a dumb question... when you try adding the fillable and guarded properties, you're just adding one or the other to the PerformancePlan model, correct?

I would recommend just adding the $fillable section to the PerformancePlan model and remove $guarded altogether. That should work.

Activity icon

Replied to Docker VS Code And WSL2

@lemmon Have you looked at Laravel Sail? Basically creates a Docker setup for you and runs Ubuntu in the container. Might be a better choice for Windows development. Super easy to setup.

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

Activity icon

Replied to Why Is The Scroll In Bootstrap Table-responsive Does Not Work On Iphone And Safari ?

@ebrahemsamer Did you put the responsive tag on the table? Or on a div outside the table?

Needs to be on a div outside the table. This messed me up at some point. Not sure if it is your issue but something to check.

Activity icon

Replied to In Laravel 8.X Inertia Stack Is It Possible To Pass Auth::user As Global Variable

@rahulkmofficial Yes. In fact Jetstream does this by simply passing and checking for a user object.

Activity icon

Awarded Best Reply on Why Setting Permission In Spatie\Permission Hav Invalid Model_type Value?

@mstdmstd You're setting your user variable to the Permission model.

Are you sure this...

$user = Permission::find($user_id);

Shouldn't be...

$user = User::find($user_id);
Activity icon

Awarded Best Reply on Docker PHPStorm And WSL2

@lemmon I do use VS Code. I have used PHP Storm but honestly felt like VS Code was more intuitive / free and frankly faster for my workflow. I also liked the level of control I have with customization. I'm sure PHP Storm has a lot of this ability but the learning curve seemed more straight forward so I stuck with VSC. I've been using it professionally as my daily driver code editor (pseudo-IDE) and haven't looked back.

Activity icon

Replied to Docker PHPStorm And WSL2

@lemmon I do use VS Code. I have used PHP Storm but honestly felt like VS Code was more intuitive / free and frankly faster for my workflow. I also liked the level of control I have with customization. I'm sure PHP Storm has a lot of this ability but the learning curve seemed more straight forward so I stuck with VSC. I've been using it professionally as my daily driver code editor (pseudo-IDE) and haven't looked back.

Jan
17
1 day ago
Activity icon

Replied to Docker PHPStorm And WSL2

@lemmon Based on your two questions, it sounds like you're trying to weigh pros and cons of VCS/PHPStorm and wondering about developing on Windows WSL2.

I have nothing to contribute to the Windows/WSL2 part, but I can say I highly prefer VSC to PHPStorm. PHPStorm honestly feels bloated (totally imo) and my workflow in VSC is super clean/it does everything I care about.

If you try out VSC, I recommend using the Laravel Extension Pack, PHP Namespace Resolver (to import/click through to classes), PHP CS Fixer (to auto-format code to PSR spec).

Good luck!

Activity icon

Replied to Why Setting Permission In Spatie\Permission Hav Invalid Model_type Value?

@mstdmstd You're setting your user variable to the Permission model.

Are you sure this...

$user = Permission::find($user_id);

Shouldn't be...

$user = User::find($user_id);
Activity icon

Replied to What SESSION_DOMAIN Should I Use If I'm Using Laravel Sail?

@ezrab_ Have you tried setting it with the Sail host and port? 0.0.0.0:80

Activity icon

Replied to Relationship Question

@sam That might be ok, but honestly, if I were you I'd just use a DB::table call to the pivot table instead of making it a model. I don't have anything specific to point to but creating a model for a pivot table would concern me that it might have unintended consequences. Models do some things under the hood of Laravel and pivot tables are really just supposed to act as bridges between model relationships / not be models themselves. Take this with a grain of salt, it's just my opinion. ...but yeah, I'd be careful with that and would maybe just reach for the table directly in this case. Just a thought, but... glad you got it figured out.

Activity icon

Replied to Tailwindcss2 @apply Directive Doesn't Work Inside Vue Component

@shekhsaifuddin Have you tried adding...

<style lang=“postcss”>
      ...
</style>

Haven't actually tried this myself, just curious if one of those missing is the issue.

Activity icon

Replied to Gmail SMTP Is Not Working On Laravel 8.12

@iyashpal I'm currently using the following settings with no problem...

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=********@gmail.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=********@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
Jan
15
3 days ago
Activity icon

Replied to Add Multiple Sites In One Laravel Forge Server

@pro_raheel Yes, you can do this. Just add sites to the server in Forge.

Jan
14
4 days ago
Activity icon

Awarded Best Reply on My Javascript File Is Over 2.07MiB

@successdav Honestly 2MB is not big at all by today's standards. Especially for a fully front loaded Vue site. It will take a little bit to load the first time but once it is cached the browser doesn't reload it. 6MB to 9MB is getting pretty big. 2MB is nothing.

If you really want to slim it down, remove packages. Switch to Tailwind instead of Bootstrap?

Even 3g wireless loads 3.1Mbps so your site will load in a few seconds on slow phones and would load in a second or 2 on most 4g+ connections.

Activity icon

Replied to My Javascript File Is Over 2.07MiB

@successdav Honestly 2MB is not big at all by today's standards. Especially for a fully front loaded Vue site. It will take a little bit to load the first time but once it is cached the browser doesn't reload it. 6MB to 9MB is getting pretty big. 2MB is nothing.

If you really want to slim it down, remove packages. Switch to Tailwind instead of Bootstrap?

Even 3g wireless loads 3.1Mbps so your site will load in a few seconds on slow phones and would load in a second or 2 on most 4g+ connections.

Jan
12
6 days ago
Activity icon

Awarded Best Reply on How To Make Unique User Without Login ?

@binggle

This is just an approach off the top of my head...

Create a middleware like php artisan make:middleware LoginOrRegisterFromIpAddress

I would add ip_address to the user table migration.

Have the middleware grab the users ip request()->ip or whatever works.

Check the users table for that ip, if it exists, log the user in.

If it doesn't exist, create the user then log them in.

Jan
11
1 week ago
Activity icon

Replied to Subteam In JetStream

@saneesh There is nothing out of the box that supports sub-teams on Jetstream right now. You'd have to code that yourself. Asking how to do that is basically asking to code it for you which probably is not going to happen unless you offer someone a paying gig to do so.

Activity icon

Replied to Models With Foreign Key Fails In Sqlite (with Foreign Keys Enabled)

@ltloafer Only thing I could think of is making sure to enable foreign keys for SQLite in the config. It sounds like you've already done that. I've actually largely avoided using foreign key constraints altogether partially for this reason of them just not being supported in all db structures.

https://laravel.com/docs/8.x/database#sqlite-configuration

Activity icon

Replied to How I Can Use V-bind:class Inside Laravel Blade File?

@devhoussam123 It is early on a Monday and I can't honestly remember why this is or isn't possible.

Suffice it to say, I'd recommend just making your nav a Vue component, then you can do this.

Activity icon

Replied to API Data Is Not Loading In Laravel 8

@nafeeur10 So you know 300 level html response codes are not errors. 400 are client errors and 500 is server errors. A 302 is a redirect message. You'll have to hunt down what you are being redirected to and why to troubleshoot this.

Activity icon

Replied to Deployment Aborting?

@dmhall0 Something is really off here. You added this to your deploy script on Forge, right? Are you even deploying on Forge with a Github repo?

Activity icon

Awarded Best Reply on Passport Or Sanctum - For Building A Gatsby Site

@embee Check out this video: https://www.youtube.com/watch?v=LE1TC4WS4CY

Oauth is basically a way of providing access to third-party clients.

Laravel Forge for example needs to allow a Github connection, thus if I was building Github and needed to allow authorization to Forge, I would need to implement Oauth (possibly with Passport) to make that possible.

This does not sound like the case for you, I'd imagine you'd be fine with Sanctum. Sanctum also tends to be a lot more straight forward for simply creating a Laravel-driven SPA with basic API authentication.

Jan
10
1 week ago
Activity icon

Replied to Modify Query Within A Variable

@untymage When I started writing these type of queries I also thought it was strange but you have to do it that way or you won't be "concatenating" the Query Builder query. That's kind of how I think of it now. You're assigning a variable and you can't just chain to that assigned variable when using conditionals. This is how you stack the blocks forward. If that makes sense.

Jan
09
1 week ago
Activity icon

Replied to Modify Query Within A Variable

@untymage I'm just stabbing in the dark because your question isn't clear.

If you don't want the initial value to be a QueryBuilder instance then don't define it as such.

$post = null;

If you don't want where('id', 1) to be the default but want it to be QueryBuilder, just start off as a query...

$post = Post::query();

if (condition) {
    $post = $post->where('id', 1);
}
Jan
08
1 week ago
Activity icon

Replied to Deployment Aborting?

@dmhall0 What do you mean you "did" them? Did you run the commands locally? You need to add that to your deploy script in Forge for this to work. Or SSH into forge and run this in your project folder. I would highly recommend adding it to the deploy script as there are a number of things that can cause these type of errors. The problem is on the server, not locally.

Activity icon

Replied to Modify Query Within A Variable

@untymage You can't call first() before finishing the query. first() calls get(). It should be the last step in your query.

Also, if you first condition is not met and the second one is, you are not calling get() or first().

Something like this maybe...

$post = Post::where('id', 1);

if(anotherCondition){
    $post = $post->where('body', 'example');
}

$post->first();

dd($post);
Activity icon

Replied to How To Access Non-data Properties?

@eng.helewa All you are doing is having a computed method add this into your data. Unless you need this to be dynamically reactive, your solution is just an over-engineered way of add a data property. Even if you need your data to be reactive, it is just adding an unnecessary complication. What would the benefit of this be?

If you added this to data, you could reference it the same way without needing a computed property or Mixin.

Activity icon

Replied to Deployment Aborting?

@dmhall0 I'll often add git reset --hard HEAD at the very top (first line, before the git pull command) of my deploy script in Forge to avoid such issues. It means exactly what it says. Some Git watched file has been modified and can't do a pull until that file is reset.

Activity icon

Replied to Laravel Deployment Related Question

@ddsameera I'm making a lot of assumptions here but just going to spout off some random advice.

  1. I would highly recommend using Laravel Forge over any other general VPS service for Laravel. I've tried a bunch and honestly, Forge was the better option all along and even allows you to host Wordpress sites, get free SSLs, actually get queues running without a ton of config. Strongly recommend this.

  2. What does your "sell to others" strategy look like? Assuming you are talking sass (software as a service).

  3. Handling concurrent logins can mean a couple things. If you just mean how does a server handle that, it is done by the server managing "sessions". If you mean how do multiple companies use it, you should deep dive into the world of multi-tenancy, preferrably with a package like Spatie Multi-Tenancy.

  4. 100 active users wouldn't require much power assuming you are just doing a general information system like a CRM or whatever. Generally I'd recommend start low, watch your resources and add whatever headroom you can afford.

Activity icon

Replied to 502 Bad Gateway Laravel Nginx

@othmannl I could write a whole slew of stuff to try but my new answer to these problems is just use Laravel Sail and save yourself the headache. 🙂

Activity icon

Replied to How To Make Unique User Without Login ?

@binggle

This is just an approach off the top of my head...

Create a middleware like php artisan make:middleware LoginOrRegisterFromIpAddress

I would add ip_address to the user table migration.

Have the middleware grab the users ip request()->ip or whatever works.

Check the users table for that ip, if it exists, log the user in.

If it doesn't exist, create the user then log them in.

Activity icon

Replied to How To Access Non-data Properties?

@eng.helewa You place it inside of the brackets for data. Then you can access with ui or this.ui. Accessing outside of data is not possible inside of a component.

Activity icon

Replied to Relationship Question

@sam Your pivot table is not a model thus you can't specify a relationship on additional data columns, at least I don't believe you can. However you can just get that id from the table and do a find to get the related user.

Jan
06
1 week ago
Activity icon

Awarded Best Reply on Seeking Opinions...

@alexsteele I find it a little misleading for Larasocket to state in their comparison screen that laravel-websockets doesn't "scale" because it is pretty robust from my understanding. I know at a Laracon Online US the guys from Spatie explained its scalability and it was pretty impressive.

I haven't tried Larasocket yet but it looks promising. I think if I wanted something bulletproof I'd just go the standard Echo/Pusher route. You get what you pay for kinda thing.

Jan
05
1 week ago
Activity icon

Replied to How Do I Upgrade From Laravel 8.9.0 To 8.21.0?

@hartleysan package.json would be updated by using npm update

Activity icon

Replied to DataGrip Vs. Workbench

@tovisbratsburg Honestly, I'm 100% in agreement with you... but I look at it like, Microsoft bought out Atom and just stole most of what was good about that. I loathe Microsoft but VS Code is something I'll actually defend as being REALLY good for the most part.

I would actually even say, PHP Storm feels more like a Microsoft product to me than VS Code does. Let that one mess with your mind for a while. =)

Activity icon

Replied to How Do You Handle Mix ENV Vars That Are Different Per Environment?

@bwrice You should really be running npm run prod in your deployment script or before deploying anyway. I would just add this command to Envoy, Forge or whatever you are using and automate that in your deployment process so you don't have to worry about it.

Activity icon

Replied to Not Able To Install Laravel/Telescope In Laravel /framework "7.*"

@ankitgarg6116 For Laravel 7.x you'll need Telescope v3.

composer require laravel/telescope "^3.0"
Activity icon

Replied to Custom Artisan Commands

@shankarnewton Could use the exec and sed command. I use this to update my .env in a bash script.

exec("sed -i '' 's/textIwantToChange/changeTextToThis/g' ./folder/filename.php");

Activity icon

Replied to Laravel SMTP Being Hijacked

@fascistdonut Having APP_DEBUG set to true could absolutely expose this. That may very well have been where someone was able to exploit credentials. Goodluck!

Activity icon

Awarded Best Reply on Named Routes

@jlung Ah ha! You actually need to pass create_url to name the route in the controller.

https://inertiajs.com/routing

Activity icon

Replied to Foreach Loop Inserts Last Array Only To Database.

@veltix Put the new/save inside the foreach loop.

foreach ($request->bookingTime as $insertBook) {
    $createBooking = new BookingTime();
    $createBooking->branch_id = $user->id;
    $createBooking->day = $insertBook['day'];
    $createBooking->start_time = $insertBook['start_time'];
    $createBooking->end_time = $insertBook['end_time'];

    if (!empty($insertBook['status'])) {
        if ($insertBook['status'] === "on") {
            $createBooking->status = "enabled";
        }
    } else {
        $createBooking->status = "disabled";
    }

    $createBooking->multiple_booking = $insertBook['multiple_booking'];
    if($insertBook['multiple_booking'] === 'yes') {
        $createBooking->max_booking = $insertBook['max_booking'];
    }
    $createBooking->save();
}