Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

bugsysha

bugsysha

Member Since 5 Years Ago

Experience Points
384,455
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
1822
Lessons
Completed
Best Reply Awards
284
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.

Level 50
384,455 XP
Nov
24
23 hours ago
Activity icon

Replied to PHP Preg_replace() - Unknown Modifier

You do not need regex for that

$string = '<h1>Title</h1>';
echo str_replace(['<h1>', '</h1>'], '', $string);
Activity icon

Replied to How To Convert Hours To Minutes

$now = now();
$now2 = clone $now;
echo $now->addHours(4)->addMinutes(25)->diffInMinutes($now2);
$time = '04:25';
[$hours, $minutes] = explode(':', $time);

echo (int)$hours * 60 + (int)$minutes;

Bunch of ways you can do it. Depends what are the requirements.

Activity icon

Replied to DateTime Vs Timestamp

I usually store all times in UTC so if I need to do any translation I can convert it with users time zone. It would be confusing to store based on devices local time. So when the event happens, I guess device will contact your app and your app can store that time in the database as UTC.

Nice video The Problem with Time & Timezones https://www.youtube.com/watch?v=-5wpm-gesOY

Nov
23
1 day ago
Activity icon

Replied to Laravel 8 Route Index Not Working

@snapey I see your point, but somehow I have more faith into lazy developers cause they tend to do more on a long run.

Activity icon

Replied to Laravel 8 Route Index Not Working

@snapey I use php artisan serve locally (when Docker is eating too much resources) cause I do not want to install Valet or Homestead, but I never had bad setup in production cause of it.

Activity icon

Replied to Laravel 8 Route Index Not Working

@snapey even project name is in the URL so I guess that is just a lazy local setup so nothing to fix.

Activity icon

Replied to Job Filtering Before Adding To Queue

@snapey that is what exactly idempotency is used for. If you would call that email sending job multiple times it would not send the email multiple times.

Nov
20
4 days ago
Activity icon

Awarded Best Reply on Laravel 8 Route Index Not Working

index URL is not defined automatically. It is called index cause it is showing all your resources for that URL.

Activity icon

Awarded Best Reply on Encrypt Data With PGP

Not sure if something like this can help https://github.com/spatie/crypto

But as I remember there was nothing complex there. What is confusing you?

$gnupg = new gnupg();
$gnupg->import('public.asc');
$gnupg->addencryptkey('fingerprint');
$encrypted = $gnupg->encrypt('json');
Nov
18
6 days ago
Activity icon

Replied to Nova - Raw Sql Instead Eloquent

Interesting. Never tried that. I guess Nova needs model that is defined in Nova resource class in order to work.

Activity icon

Replied to Fresh Nova Install Resulting In 404

Check the routes. Check log files. To me it does not provide any value saying "tried running php artisan config:cache and added a user through the Nova CLI, all with no luck". What was the error? Did error occur?

Activity icon

Replied to Vue.js Issue

follows="{{$follows}}"

This part probably still has previous value that was not updated. How do you get that from the database to the HTML?

Activity icon

Replied to Wait For Jobs To End In Testing With Multitenancy Environment

I'm not sure if I'm missing something but if you are writing that test, why don't you first "generate the pdf" and assert that the URL is accessible, and only after that you destroy the tenant?

Activity icon

Replied to Vue.js Issue

It is in your HTML, not PHP. It can be in PHP also, but it needs to be tracked down through HTML.

Activity icon

Replied to Laravel 8x: Phpunit Expected Status Code 204 But Received 429. Failed Asserting That 204 Is Identical To 429

That is a bad test. And it is failing cause you probably have throttling enabled for that route or in general on your project.

https://laravel.com/docs/8.x/routing#rate-limiting

Nov
17
1 week ago
Activity icon

Replied to Vue.js Issue

Problem is that follows prop that you pass to your component is outdated. You need to fetch fresh data from the server. So the cause of the issue is outside of this component.

Activity icon

Replied to Javascript : How To Filter Only One Nested Property In An Array Of Objects?

Not sure I fully understand the description but let me try:

jsVariableContainingWhatYouPosted.searchable_columns.filter(i => !['face_style','birth_date'].includes(i.name))
Activity icon

Replied to Encrypt Data With PGP

OK, then I'll leave you to figure it out so I don't disrupt your concentration. Don't worry. You will make it.

Nov
16
1 week ago
Activity icon

Replied to Encrypt Data With PGP

Not sure if something like this can help https://github.com/spatie/crypto

But as I remember there was nothing complex there. What is confusing you?

$gnupg = new gnupg();
$gnupg->import('public.asc');
$gnupg->addencryptkey('fingerprint');
$encrypted = $gnupg->encrypt('json');
Activity icon

Replied to Unit Test OrWhereHas,whereHas Conditions Using Fakers

You can add $this->withoutExceptionHandling() in your test method and see what is it complaining about. From what I see your URL seems bit strange. I guess instead of api/order/search you should have api/order/search/. Missing slash at the end.

Activity icon

Replied to Unit Test OrWhereHas,whereHas Conditions Using Fakers

You do not test orWhereHas and whereHas. You test the response.

  1. Seed the database with specific data
  2. Make the request
  3. Assert that the request contains correct data

You can make few tests for this or cover everything with single test.

Activity icon

Replied to How To Best Handel 1500 Requests A Second

Please report back how it works out for you and your project. Thanks for "Best Answer" :)

Activity icon

Awarded Best Reply on How To Best Handel 1500 Requests A Second

Laravel Vapor feels like a perfect choice.

Activity icon

Replied to How To Best Handel 1500 Requests A Second

You are right, any other suggestions on how to handle all these requests in the code

I would have to know lot more about your code and things that happen in order to say something smart, but considering that you've said:

We started optimizing our cloud for this high traffic, by hitting the database only when it is really necessary, and using caching when possible, we have also moved all the logic to handle the request from a sensor to a job so that we can queue it and return as soon as possible.

I think you are on the right path.

Activity icon

Awarded Best Reply on Att Type In Laravel

what's the different between : $table->string('xx',1) and $table->char('xx',1) , and there is a limite in the lenght or no ?

They are the same on my setup varchar. Length by default is 255 if you do not provide something else or override it.

and also for URL which is the best to use $table->string or $table->text ?

If you are sure that your URLs will not exceed 255 character limit then you are fine with using string. If not then it is better to use text or longText.

Activity icon

Replied to How To Best Handel 1500 Requests A Second

Yeah. But in my mind that does not make sense for a company that has 1500 requests per second to save $39 per month and waste who knows how much time on setup and maintenance.

Activity icon

Replied to Att Type In Laravel

Haven't checked that in a while, but I think that 65536 is the max for varchar.

Activity icon

Replied to Att Type In Laravel

what's the different between : $table->string('xx',1) and $table->char('xx',1) , and there is a limite in the lenght or no ?

They are the same on my setup varchar. Length by default is 255 if you do not provide something else or override it.

and also for URL which is the best to use $table->string or $table->text ?

If you are sure that your URLs will not exceed 255 character limit then you are fine with using string. If not then it is better to use text or longText.

Activity icon

Replied to Payment Gateway

Payment gateway talks to the bank. You app only talks to payment gateway. Then from payment gateway you withdraw the money to the bank account.

Activity icon

Replied to How To Best Handel 1500 Requests A Second

Laravel Vapor feels like a perfect choice.

Nov
15
1 week ago
Activity icon

Replied to Using Dash Instead Of Slash In Routes

What is wrong with this?

Route::resource('/product-phone', 'ProductPhoneController');
Nov
14
1 week ago
Activity icon

Replied to Do You Mock Service Classes In Feature Tests?

@elenktik depends on the size of the app. If the app is small then I might have database interactions in "service class" methods. But if the app is big then I try to avoid it since you can have to many database queries in single request.

Activity icon

Awarded Best Reply on Do You Mock Service Classes In Feature Tests?

In my unit tests I avoid any tests that interact with the database cause that makes them slow. I only test the PHP code. But in my feature tests I do not mock business logic classes cause I want to make sure that the database has correct changes when the work is done.

Activity icon

Replied to Do You Mock Service Classes In Feature Tests?

In my unit tests I avoid any tests that interact with the database cause that makes them slow. I only test the PHP code. But in my feature tests I do not mock business logic classes cause I want to make sure that the database has correct changes when the work is done.

Activity icon

Replied to Route Model Binding [Internal 500 Server Error]

Go to storage/logs/laravel.log and see what the error is.

Nov
13
1 week ago
Activity icon

Replied to "Deploy Now" Fails But SSH Works

LOL, at no point did I figure out that you were talking about Forge :facepalm:

Activity icon

Replied to Anyone Know What Authentication Middleware To Apply To Laravel Excel?

Thanks for the “Best Answer”. All best.

Activity icon

Awarded Best Reply on Anyone Know What Authentication Middleware To Apply To Laravel Excel?

That method does not exist on that class. You can use that method on controllers. So in your controller you can add that to the constructor or define middleware in your route file.

Activity icon

Awarded Best Reply on Saving Ip Addresses And GDPR Anyone Knows?

You can just use route throttle. No need to bother with storing the IP and GDPR. Search for throttle on this page https://laravel.com/docs/8.x/middleware

Activity icon

Replied to Return Json Response Or A View

But i saw this mix on Macrumors and I wanted to create the same thing and I was not sure how to do it.

That does not change the fact that you should use one technique which is either AJAX or "search form".

Activity icon

Replied to "Deploy Now" Fails But SSH Works

Who wrote the script. It is probably logging in with the sudo user or executing something. If you are sure that you will not break anything then just update sudo version of npm.

Activity icon

Replied to Saving Ip Addresses And GDPR Anyone Knows?

Important thing is that it works and you do not have to worry about it.

Activity icon

Replied to "Push" A Value Choice Inside My Div.

Sorry. Never used Angular.