bugsysha

Member Since 6 Years Ago

Experience Points
482,885
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
2000
Lessons
Completed
Best Reply Awards
398
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
482,885 XP
May
05
3 days ago
Activity icon

Awarded Best Reply on Do I Need To Be PCI Compliant To Integrate With 2checkout Gateway?

how can I accept card data safely

2checkout will provide you. Try searching if there is an option to use it with Laravel Cashier. That will reduce the time you need to put in to make it work and definitely reduce the complexity.

do I need to be PCI compliant

Nope.

what is required to become a one?

Simple googling can probably tell you far more than anyone here.

Activity icon

Replied to Running Seeders Via Laravel Controllers

I agree. Running seeders from controllers is a very bad idea.

Activity icon

Replied to Do I Need To Be PCI Compliant To Integrate With 2checkout Gateway?

how can I accept card data safely

2checkout will provide you. Try searching if there is an option to use it with Laravel Cashier. That will reduce the time you need to put in to make it work and definitely reduce the complexity.

do I need to be PCI compliant

Nope.

what is required to become a one?

Simple googling can probably tell you far more than anyone here.

Activity icon

Replied to Trim Char Data Type

That way you are trying to find a cure for the consequence, not for the root cause of the problem.

May
04
4 days ago
Activity icon

Replied to Trim Char Data Type

Then create a command that will trim all problematic records in the database. I'm suggesting a command cause then you can use it as much as you need until you resolve all your issues.

Activity icon

Replied to Laravel - Composer Dependencies Require

I'm confused. Is it 8.0.3 or 8.0.5? I guess that is a typo?

Activity icon

Replied to Trim Char Data Type

Is there a way I can trim the original values before Laravel captures them?

Laravel already trims the input. You can verify it by going to \App\Http\Kernel and in $middleware property you should see \App\Http\Middleware\TrimStrings::class.

Activity icon

Replied to Protected Route

If you wan't to hide it from Network tab in Browser Dev Tools, then it isn't possible.

Activity icon

Replied to Selectively Disabling Cookies In Laravel 8

I assume you can extend \Illuminate\Session\Middleware\StartSession middleware and replace it in \App\Http\Kernel::$middlewareGroups['web']. Then within your middleware class you can decide when not to add cookies and when to add them.

Activity icon

Replied to Extracting Style CSS From Vue Components

Maybe you can start by extracting it to a separate file.

<template></template>

<style src="pathToCssFile"></style>

<script></script>
May
01
1 week ago
Activity icon

Awarded Best Reply on Recommended Video Player /tutorial For Vue

You have it here on Laracasts. I've ended up building everything manually cause I needed better performance and more control. Depending on what you are planning to build it may or may not make sense for you to do the same.

Activity icon

Replied to Recommended Video Player /tutorial For Vue

You have it here on Laracasts. I've ended up building everything manually cause I needed better performance and more control. Depending on what you are planning to build it may or may not make sense for you to do the same.

Activity icon

Replied to Using Non-anonymous Functions In Eloquent Subquerries

Also here you can find some different approaches to the same problem.

Activity icon

Awarded Best Reply on Using Non-anonymous Functions In Eloquent Subquerries

There are few options here. Depending on what you like.

First option:

User::select($some_select)
	->when($bool, \Closure::fromCallable([$this, 'my_method']))

Second option:

  • define the class
class SomeClass
{
    public function __invoke()
    {
    }
}
  • use the class
User::select($some_select)
	->when($bool, new SomeClass)

Activity icon

Replied to Using Non-anonymous Functions In Eloquent Subquerries

Just note that you'll have problems like following:

$something = 123;

User::select($some_select)
	->when($bool, \Closure::fromCallable([$this, 'my_method']))

You will have no option to do:

User::select($some_select)
	->when($bool, function () use ($something) {})

So for that reason it is better to use the first option so you can do this:

$this->something = 123;

User::select($some_select)
	->when($bool, \Closure::fromCallable([$this, 'my_method']))

protected function my_method()
{
  // you will have access to something property
  $this->something
}
Activity icon

Replied to Using Non-anonymous Functions In Eloquent Subquerries

There are few options here. Depending on what you like.

First option:

User::select($some_select)
	->when($bool, \Closure::fromCallable([$this, 'my_method']))

Second option:

  • define the class
class SomeClass
{
    public function __invoke()
    {
    }
}
  • use the class
User::select($some_select)
	->when($bool, new SomeClass)

Activity icon

Awarded Best Reply on Where Should I Put My Vue Assets In Laravel? In Public Or In Components Directory Of Vue

Just do <img src="/path-from-public-folder/picture.jpg"/> if the image is located at public/path-from-public-folder/picture.jpg.

Apr
29
1 week ago
Activity icon

Replied to Is Laravel Observer Supported In The Lumen?

I use observers, but I don't think you need them.

Activity icon

Awarded Best Reply on Subtitle Support

I would advise you to invest in English since you will gain so much from it. Almost all communication on all forums is in English, so you will be able to find solutions far easier. Also if you want to work for some company you would probably have to communicate in English, and especially write code in English also. Without it I don't think you would have a shot to apply and get the job which might be paying way more than your local companies.

Activity icon

Replied to Is There A Better Way To Grouping An Array Parent And Child?

What is considered better in your mind? If it is performance, then probably not. If it is code readability then yes.

Activity icon

Replied to Subtitle Support

I would advise you to invest in English since you will gain so much from it. Almost all communication on all forums is in English, so you will be able to find solutions far easier. Also if you want to work for some company you would probably have to communicate in English, and especially write code in English also. Without it I don't think you would have a shot to apply and get the job which might be paying way more than your local companies.

Apr
28
1 week ago
Activity icon

Replied to Disappearing Url Query String

What for are you using it? Video is not revealing everything so I don't understand how can you use something that feels unrelated. I'm probably missing some detail.

Activity icon

Replied to Disappearing Url Query String

That is a normal behaviour. Query param page has no use on the show page. It needs to be removed.

Activity icon

Replied to Laravel IsDirty() & GetOriginal() Not Working With Pivot Relationship In Observer

Maybe you should move this to updating method on the observer.

Apr
27
1 week ago
Activity icon

Replied to ES6 Vs Lodash

Yes it is useful, but I haven't used it since ES6 was available. Just my personal preference to avoid dependencies.

Apr
26
1 week ago
Activity icon

Replied to Loading Components From Package

Put dd('something') into render method on your component. That way you will know if the component is the issue or the view. Also try running composer dump-autoload and clearing all caches (php artisan cache:clear, php artisan view:clear, etc...).

Apr
24
2 weeks ago
Activity icon

Replied to Sending Two Different Notifications For A Single Event

I usually break it down into following steps:

  1. save the quote request to the database
  2. emit the event
  3. with listener send email that the request was received, but I don't see the point for this since you can do that with a simple notification on the page that says "request received"
  4. notify the site owner that a request has been received
Activity icon

Replied to Required Field If Client Is Logged In.

If you create a form request, you can check if the user is authenticated, and which type of a user, and based on that return appropriate rules from the rules method.

public function rules(): array
{
    $rules = [
        'name' => 'required|boolean',
    ];

	if ($this->user()) { // this is to check if they are logged in
		$rules['something'] = 'required|string';
	}

	if ($this->user()->isSomething()) { // here you check for a type
		$rules['something-else'] = 'required|string';
	}

    return $rules;
}
Activity icon

Replied to Save Individual Article Views

Also if you need more control then maybe you should use JavaScript version of fingerprint.

Activity icon

Replied to Save Individual Article Views

Yeah. It is based on couple of things. You can find it here. I've used it for some projects while ago. It worked fine.

Activity icon

Replied to Save Individual Article Views

What might be better, but not perfect, is fingerprint on the request object. So try $request->fingerprint().

Activity icon

Replied to Loading Components From Package

Have you tried <x-queryUrl::sort sort="Group"/>?

Activity icon

Replied to Save Individual Article Views

You can probably use firstOrCreate() on the model in to simplify the code.

Activity icon

Replied to What Is The Good Design For Multiple Social Login Database On User?

That depends on what do you want to allow your users to do. I don't think you can go right or wrong here. You can present to them all profile pictures from social accounts and let them pick the one that they like the most. Only limit is your imagination.

Activity icon

Awarded Best Reply on Laravel WantsJson()

I don't thing anyone can give definite answer to what is better. Depends what the criteria for better is. If it is speed of development, I guess that depends on the team and what they are proficient with. If it is less work, then probably blade files. But you would still have to do the routing for the API and probably use API resources or some other way to transform the data so it is API compliant. If someone says one way is better than the other, then they are probably biased cause of their familiarity or what they are used to.

Activity icon

Replied to Laravel WantsJson()

I don't thing anyone can give definite answer to what is better. Depends what the criteria for better is. If it is speed of development, I guess that depends on the team and what they are proficient with. If it is less work, then probably blade files. But you would still have to do the routing for the API and probably use API resources or some other way to transform the data so it is API compliant. If someone says one way is better than the other, then they are probably biased cause of their familiarity or what they are used to.

Activity icon

Replied to Laravel 7.x - Validate Route Parameters Of GET Request Without Regular Expression Constraint

It was a poor name choice on the part of the authors in my opinion, as a 'Form' from the front-end is typically associated with a POST request.

Yeah, I also find that naming bit strange. But once you learn what it is used for you just roll with it.

Then something about it being a GET request will cause the request to continually attempt to redirect if overTime is not equal to 1, 2, or 3. I want it to return a validation error. Is there a way I can do this?

You've specified that the value of overTime needs to be 1, 2 or 3. That is why you get redirected back. If you are using blade you can do following:

@error('overTime')
<p>overtime is wrong</p>
@enderror
Apr
23
2 weeks ago
Activity icon

Replied to What Is The Good Design For Multiple Social Login Database On User?

I had situations were we had separate user for every social account and in the end we wanted to merge them. And also the opposite. So it depends on what do you need from business perspective. I would rather go with single user with multiple accounts.

I think it all depends on wether you want to show apps related to those social accounts. If you have a calendar in your app for which you pull data from Google Calendar or Microsoft Calendar then it depends on the use cases you want to cover. If you want to show data from both GC and MC at the same time, then one user account should be "linked" to multiple social accounts. If that is not what you want/need, then other approach might be better where you have one user per social account.

Activity icon

Replied to Laravel WantsJson()

Not sure I fully understand your question but I would either create an API from start and combine it with an SPA, or go down the traditional route where I return HTML. Combining two never worked for larger projects, and I assume this will be a larger project as you are planning iOS/Android apps.

Activity icon

Replied to Laravel 7.x - Validate Route Parameters Of GET Request Without Regular Expression Constraint

It seems like bad design to make a FormRequest since, as far as I understand, form requests should only be used for POST requests.

That is a wrong assumption in my mind. I create them always.

Activity icon

Replied to Live Video Stream Project

I've tried to reply but I got an error saying Spam detected. Please rephrase.. Sorry but I guess my solution can not be suggested :D

Apr
22
2 weeks ago
Activity icon

Awarded Best Reply on Overriding FirstOrNew() Of A Model

public static function firstOrCreate(array $attributes = [], array $values = [])
{
  $result = parent::query()->firstOrCreate($attributes, $values);

  // top secret work

  return $result;
}

Overriding of built in functions/methods as firstOrxxx() is NOT RECOMMENDED.

Might be useful:

Activity icon

Replied to Overriding FirstOrNew() Of A Model

@laracoft updated per your liking sir 🥳

Activity icon

Replied to Livewire Polling Dynamically Adjust Interval

@mst526 great find. It (wire:key) sounds familiar but I've forgot about it definitely.

Activity icon

Replied to Overriding FirstOrNew() Of A Model

public static function firstOrCreate(array $attributes = [], array $values = [])
{
  $result = parent::query()->firstOrCreate($attributes, $values);

  // top secret work

  return $result;
}

Overriding of built in functions/methods as firstOrxxx() is NOT RECOMMENDED.

Might be useful:

Activity icon

Replied to Overriding FirstOrNew() Of A Model

Don't get me wrong. I don't suggest it.

Activity icon

Replied to Overriding FirstOrNew() Of A Model

Shouldn't it be:

public function firstOrCreate(array $attributes = [], array $values = [])
{
  $result = parent::firstOrCreate(array $attributes = [], array $values = []);

  // top secret work

  return $result;
}
Activity icon

Replied to Laravel-Livewire Project With Shared Server Issues

I would argue that what you are doing right now is an overkill. Or even worse cause you are wasting your time on things that don't matter. Or if possible even worse, you are wasting your time over and over again on the things that don't matter.

As I said, for the same price you are paying right now you can get a VPS. Probably there won't be any difference cause hardware will be pretty much the same.

Activity icon

Replied to Overriding FirstOrNew() Of A Model

Is there a way to override firstOrNew() of a model?

Yes, just inside of your model (or maybe better trait) define a method with same name.