Cyber Monday! Get 25% off for as long as you keep your subscription. New subscribers only.

LTroya

LTroya

Member Since 4 Years Ago

Experience Points
35,730
Total
Experience

4,270 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
336
Lessons
Completed
Best Reply Awards
1
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 8
35,730 XP
Oct
01
2 months ago
Activity icon

Commented on Datatable Testing

I don't know why but I am getting a migration's error on the first test

ErrorException: SQLSTATE[HY000]: General error: 1 near "ILIKE": syntax error (SQL: select count(*) as aggregate from "users" where "status" = 1 and ("name" ILIKE %% or "email" ILIKE %%)) (View: /var/www/learning/livewire-examples/resources/views/pagination.blade.php) in file /var/www/learning/livewire-examples/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 671\n

I tried using RefreshDatabase trait, but I got the same error. Any ideas?

----- Update ------

If I comment this two lines on phpunit.xml it works:

<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

But it uses the posgres database configured in .env and migrate all the schema deleting the current data

Activity icon

Commented on Datatables

Nevermind Andre, wire:loading is what I was looking for.

I put this into the table wire:loading.class="bg-gray" is a nice effect when the component is re-rendering!

Activity icon

Commented on Datatables

Thanks Andre, really great videos.

I was wondering if there is a way to know when the component is doing the query to the database to show a loader or loading message

Sep
17
2 months ago
Activity icon

Commented on Guzzle API Requests With Tests

Thanks for the great tutorial!

One think I don't understand quite well was the swap of the client. The HandlerStack, where can I find some docs about it?

Thanks

Sep
16
2 months ago
Activity icon

Replied to How Do I Pass User_id For Updating Perpose In Admin Page?

Another approach is adding the $userId on the url.

/application/update/{user}

In your form you pass the $user on the form's action:

action="{{route('application.update', $user)}}"

And finally, you can use model binding in your controller:

public function update(User $user, Request $request)

If the user doesn't exists, it will thrown a 404 error automatically

Hope it helps.

Sep
15
2 months ago
Activity icon

Commented on Upgrade The Laracasts Codebase To Laravel 8

How are your tests so fasts? How do you configure your enviroment? Maybe because I am using docker but it takes 1-2 seconds each test

Jul
16
4 months ago
Activity icon

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

Show the logs to try to understand it. An error 500 is too ambiguous

Jul
14
4 months ago
Activity icon

Awarded Best Reply on Search A List Of Data

You can add it before the get() like this

$unitList = store::where(function ($q) use ($searchValues) {
          foreach ($searchValues as $value) {
            $q->orWhere('unit_id', 'LIKE', '%' .$value. '%');
          }
        })->where('status', 0)->get();
Activity icon

Replied to Search A List Of Data

You can add it before the get() like this

$unitList = store::where(function ($q) use ($searchValues) {
          foreach ($searchValues as $value) {
            $q->orWhere('unit_id', 'LIKE', '%' .$value. '%');
          }
        })->where('status', 0)->get();
Jun
03
5 months ago
Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

@snapey Sorry, I didn't understand your previous answer, my bad.

The data comes from a test

/** @test */
    function it_should_update_a_debt()
    {
        $this->withoutExceptionHandling();
        $this->signIn();
        $debt = create(Debt::class, ['user_id' => auth()->id()]);
        $debt->name = 'John Doe debt';
        $debt->value = 100;
        $debt->begin_date = '2020-01-10';
        $debt->end_date = '2020-07-10';

        $response = $this->json('POST', '/api/debts', ['entities' => [$debt]]);
        $response->assertStatus(200);

        $this->assertCount(1, auth()->user()->debts);
        $this->assertEquals('John Doe debt', $debt->name);
        $this->assertEquals(100, $debt->value);
        $this->assertEquals('2020-01-10', DateHelper::applyFormat($debt->begin_date));
        $this->assertEquals('2020-07-10', DateHelper::applyFormat($debt->end_date));
    }

Even if I have this lines:

$debt->begin_date = '2020-01-10';
$debt->end_date = '2020-07-10';	

The request class received the following:

"begin_date" => "2020-01-10T00:00:00.000000Z"
 "end_date" => "2020-07-10T00:00:00.000000Z"

If I remove this lines from my model

protected $dates = [
        'begin_date',
        'end_date'
    ];

I received the dates as expected, like this:

 "begin_date" => "2020-01-10"
 "end_date" => "2020-07-10"

That is the reason I mentioned it before.

Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

Thanks a lot @bugsysha! I tried Y-m-d\TH:isu\Z without the .

Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

@bugsysha

Value: "begin_date" => "2020-01-10T00:00:00.000000Z"

Rule: 'entities.*.begin_date' => 'sometimes|date_format:' . \DateTimeInterface::ATOM,

Validation error message: 0 => "The entities.0.begin_date does not match the format Y-m-d\TH:i:sP."

Maybe it helps, this is the information I get from date_parse_from_format:

array:13 [
  "year" => 2020
  "month" => 1
  "day" => 10
  "hour" => 0
  "minute" => 0
  "second" => 0
  "fraction" => 0.0
  "warning_count" => 0
  "warnings" => []
  "error_count" => 1
  "errors" => array:1 [
    19 => "The timezone could not be found in the database"
  ]
  "is_localtime" => true
  "zone_type" => 0
]

This is the code I use to try to debug formats:

\Validator::extend('date_formats', function ($attribute, $value, $formats) {

            foreach ($formats as $format) {
                $parsed = date_parse_from_format($format, $value);
                if ($parsed['error_count'] === 0 && $parsed['warning_count'] === 0) {
                    return true;
                }
            }
            return false;
        }, 'The :attribute not following the correct formats');
Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

@bugsysha that's what I want. But I don't find the correct date format to give it as parameter to date_format

Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

Hi @bugsysha, how I can apply that format? Using prepareValidation on request class? Maybe my explanation wasn't enough but I will try that format

I was struggling with php format dates, for example, Y is equal to YYYY on js. I can't build the correct format from the docs

This date 2020-01-01 has the following format on php Y-m-d, js is YYYY-MM-DD

Activity icon

Replied to How Can I Make This Format Pass Date_format Request Validation?

Hi @snapey, because I comment the $dates property in my model and doesn't apply the format I mentioned

I have this:

protected $dates = [
        'begin_date',
        'end_date'
    ];
Jun
02
5 months ago
Activity icon

Started a new Conversation How Can I Make This Format Pass Date_format Request Validation?

For some reason my request is parsing any date format to this before starting the validation: 2020-07-10T00:00:00.000000Z

This is my rule: 'entities.*.begin_date' => 'sometimes|date_format:Y-m-d\TH:i:sss\Z but validation fails.

I tried the following formats but not work:

  • Y-m-d\TH:i:sss\Z
  • Y-m-d\TH:i:s\Z

Which format do I have to use in order to pass the validation?