mohammadkaab

mohammadkaab

Member Since 7 Months Ago

Experience Points
3,120
Total
Experience

1,880 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
25
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.

Level 1
3,120 XP
Oct
13
2 days ago
Activity icon

Commented on Refactoring Insurance

A lot of logic in Feature-test

Oct
06
1 week ago
Activity icon

Started a new conversation Creating Custom Rule For Multiple Fields

Hi,

I would like to know if creating a rule in this way is a good practice or not. I have created a rule, in which this rule depends on two fields. so is't okay to create a rule and involve other fields into the rule?

'FieldB'=>'Required',
'FieldA' => ['Required', new CustomRule()]

Class CustomRule{
    
    public function passes($attribute, $value)
    {
        if($value== 'Custom'){
            $fieldB = \request()->FieldB;
            if($fieldB != 'Custom'){
                return false;
            }
        }
        
        return true;
    }

    public function message(){
        return 'FieldA and FieldB should both have Custom values if FieldA contains Custom value.';
    }
}
Sep
21
3 weeks ago
Activity icon

Started a new conversation Should We Use Those Migrations Which They Are Only For Changing The Data

Hey guys,

We have a bunch of migrations (200+) which most of them are there to change the data in the database and that affect our testing. For example we have a migration like this one

 public function up()
    {
        $deleteId = DB::table('lookups')
            ->where('code', '=', 'VI')
            ->where('type', '=', 'country')
            ->where('value', '=', 'U.S. Virgin Islands')
            ->first(['id'])->id;

           DB::table('lookups')
                ->where('id', '=', $deleteId ?? 0)
                ->update(['deleted_at' => Carbon::now()->toDateTimeLocalString()]);
    }

As you can see this will throw an error if we run it in the testing env. because the record does not exists in the testing environment. (we are using faker for that purpose). and my question is, should we some how skip this kind of migrations or what is the best solution?

Jul
24
2 months ago
Activity icon

Started a new conversation Using Transaction !!! Or Maybe A Better Solution

Hi guys, Sorry for the title, it seems the best title I can find. basically, we have some jobs which they store in the database. these jobs are going to calculate some financial numbers. I just know they are calculating something and after they finish the calculation they will update the balance field in parents table with a new number. okay, now I should say this, our CRON starts 10 jobs per each time. so basically we are not talking about the sequence jobs, we are talking about running jobs in parallel. okay, now every job needs the balance field in parents table and let's guess there are 3 jobs which they need the balance value of the parent's table of the same parent. now let's presume that the first job is running and it's in the middle of the process then the second job starts its process, what do you think will happen for the balance field?

Well here is the scenario. first job run took the value of balance field in parents table the first job is in the middle of the process second jobs run the second job took the same balance from parents table the first job finishes the process the first job update the balance field the second job finish the process the second job update the balance field

So basically the first job calculation value has disappeared. because the second job updated the balance field by using the value which has not yet updated by the first job. one solution for this problem is that we should check before every update that if the balance field has a different value from the first time then we should get the new value from balance and recalculate using the new value in balance. But I'm wondering if you guys know something more or better.

Jul
10
3 months ago
Activity icon

Started a new conversation Using Logging Coverage-clover Is Surprisingly Slow

Hi everyone

recently I have added the coverage-clover into phpunit.xml to produce a report. And after that, I can use that report to check how much code coverage we have. But actually, I'm not using that report. I have written command and that command does it in auto mode when every developer pushes their code. First problem: it takes to much time. before using this feature our tests were run in 3.30 min. but after using this feature it takes more than 7 min which is not really good. Now my question is, do you think it's a good way to use it like this way, that I'm using it? If no, please tell me your solution. Thanks.

Jun
24
3 months ago
Activity icon

Replied to Migrate:rollback Is Not Working When Test Stop

Actually, the problem with using refresh, is that it doesn't remove views from database and that was the problem actually. I've just made my refresh and i'm calling it in every setup. But this problem seems only happening in mysql.

Jun
23
3 months ago
Activity icon

Started a new conversation Migrate:rollback Is Not Working When Test Stop

Hi guys I have met a really new strange problem, Actually, I have started writing tests for my code (EtoE), now when I want to see the response of the API I need to put dd and check if the API contains the response or not. The problem Is that when DD stops the code. on the next tests, it'll throw an error that XTable already exists which this means that when my DD stopped the code then migration rollback has not worked.

So any clue of how to solve this issue?

Jun
14
4 months ago
Activity icon

Replied to Automatically Checks If Code Contains Test Or Not

Thanks for your answer and sorry for the little information, Actually I'm currently using this https://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/ link to do what exactly you said. But I thought maybe we have another way to handle it. Also, we are using BitBucket CI.

Activity icon

Started a new conversation Automatically Checks If Code Contains Test Or Not

Hi guys

I'm wondering if there is a way to automatically check the pull-requests code and also check if the code contains tests.

May
14
5 months ago
May
13
5 months ago
Activity icon

Started a new conversation Laravel Dusk Can't Run Two Tests Referring To One Page

Hi I'm writing a couple of tests with LARAVEL dusk and I've recently dumped to a new problem. well, the problem is very famous and everyone has seen it for once at least Actually I have two tests which they are calling the same page and also posting the same page. (I mean submitting the same page). The first test works as expected and the response is exactly as I want. but the second test is giving a bit different response. The response

The Page has expired due to inactivity.
Please refresh and try again.

I don't want to disable CSRF-TOKEN I've also used javascript to fill the _token field with a new token but still the same response I'm trying refresh method still the same response

More info: When I just commented the first test the second test works as expected. so maybe the reason of the problem Is the first test. But I don't know really what should I do to make this works. Any clue guys? Thanks for any help.

May
03
5 months ago
Activity icon

Started a new conversation Fail_job Using The Old Data When They Retry Again

Hi,

I'm wondering if you have ever face such problem, I've a job and my job failed for some reasons now after 5 days I want to restart my failed_job. I'm wondering if I restart my job, does it use the old information which it was using 5 days ago, since there some sql queries and some other calculation which it's related to the database.

Thanks for any answer.

Apr
30
5 months ago
Activity icon

Replied to Attach A New Class To An Interface In Testing

Actually I did not find the problem so far, so basically that what I've done, just changed some of the bindings in serviceProvider file so I've just put some a condition to check if it's testing env or rather something else. this solve the issue Thanks any way.

Activity icon

Started a new conversation Attach A New Class To An Interface In Testing

Hi everyone

Actually I'm binding a new concrete class to an interface in one of my test classes so this way stoping the app of calling the real classes but what I'm facing it's a really funny problem. now in one of my tests I'm calling an api and that api code it's also calling a method in a different class. the problem is here that the binding it's totally working in the api code but when the api code calling a method from a different class the binding it's not working there and it's using the real class which which it's should not use.

Apr
03
6 months ago
Activity icon

Started a new conversation Log Wants To Put Content In Strange Address

Hi every one, sometimes I've noticed that laravel tries to log into wrong file and the address it's very strange

file_put_contents(/v3m7spJxlUyrx7hByso2as4avezAmqclAuKm9Hix) 

Have you ever face this kind of errors ? or why this is happening ?

Mar
19
6 months ago
Activity icon

Replied to Clean My Code Of \Log::

Yeap thanks, But I though there is more. since laravel model event not covering all of the parts of the project

Mar
18
6 months ago
Activity icon

Replied to Clean My Code Of \Log::

Logs should stay, What Do I mean with cleaning the code it's not mean to remove them, I mean to find a way to just not see them there in the Code but they actually work, let's call it behind the scene, One of my ideas it's to create an event for each of the controller action and at the end of each action Just trigger a handler according to that event. in that way, I'll extract all of the logs. But I thought maybe there is a better solution for it.

Activity icon

Started a new conversation Clean My Code Of \Log::

Hi everyone, I've started working on a project which increased growth in code since the customer requirements always are the most important portion of the whole process. so after one year when I'm just looking at my code I can see there are 5 places in one method which I've written Log::info, Log::error, Log::warning and That's really pain in ass when you should skip the log when you are just tracking the code and it's like hey common skip me I'm nothing. now I'm wondering somehow if you have a solution for that I mean if I can clean the code or at least extract those Logs or any mechanism you are using which I'm blind to it.