rudexpunx

rudexpunx

Member Since 2 Years Ago

Experience Points
14,070
Total
Experience

930 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
129
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 3
14,070 XP
Jan
17
1 month ago
Activity icon

Replied to Securing Endpoint Being Used By Our Other Server

Shame I missed that vital part of Passport documentation.

Thank you for your quick response and getting me on the right track @fylzero

Activity icon

Started a new Conversation Securing Endpoint Being Used By Our Other Server

We have two servers running. One is typical webserver running our Laravel based website. The other one is a machine that runs constantly as well and works on repeated tasks. Once it finishes a task, it sends resulting data to webserver endpoint via POST request, which takes the data and stores it in database.

My question is, how would you secure the endpoint? We are using Passport for our API routes, but this one is different purpose - no user authentication and it's not a public endpoint. It would be nice to have just two keys on the machine that would allow webserver to authenticate its requests. Is there any package that would make a good fit for such a use case?

Thanks

Jan
10
1 month ago
Activity icon

Replied to How To Make Eloquent Belongs To Many And Has One Relationship On Same Model.

Create two relationships. One for members and another for manager. Manager:Project will be 1:N, Members:Project M:N. Looks like you already have project_member pivot table created. Just don't forget to specify pivot table explicitly, as Eloquent will be looking for project_user otherwise.

Activity icon

Started a new Conversation API Route Accessible For Both: Authenticated And Unauthenticated

I have one API route (GET), which frontend calls in order to get data to render. This route should be accessible for unauthenticated visitors, so they get the data (in such case, some fields may be null/false, taking care of that in the backend - using Auth::check()). If authenticated user calls that route, I need to run the request through auth:api middleware, so I get auth user, and serve him accordingly.

The issue: If I use auth:api middleware on the route, it works for authenticated, but of course returns 401 for unauthenticated user. If I don't use the middleware, it works fine for unauthenticated, but won't get user specific data for authenticated user.

What is the best approach to this scenario? So I can keep single route but make it work for both.

I use Passport (OAuth).

Thanks

Nov
30
2 months ago
Activity icon

Started a new Conversation Localize Model If Requested From A Web Route

Hi,

I want to localize my model object in case it's requested by any web route (whatever in web.php).

Otherwise (api.php), I want to return model as retrieved from DB.

First idea was, to use retrieved event on the model, but that would require asking if the request is coming from web middleware group or something like that, which doesn't seem too good.

The best way to tackle this would be probably via dedicated middleware, but the question is, how can I find out which middleware group is request coming through?

Or do you have any better idea, to solve this?

Thanks

Nov
02
3 months ago
Activity icon

Replied to Access Validated Values In Nested Array Validation

Any idea? I still haven't found anything convenient... Seems like common use case though.

Oct
24
4 months ago
Activity icon

Started a new Conversation Access Validated Values In Nested Array Validation

When validating update request for a model, I often use form request and access object being update like $this->route('attribute');

So validating unique attribute looks like this:

public function rules()
    {
        return [
            'name' => 'required|string|unique:attributes,name,' . $this->attribute()->id . ',id'           
        ];
    }

    protected function attribute(): Attribute
    {
        return $this->route('attribute');
    }

but what if I need to validate nested array values (for relationship for example):

public function rules()
    {
        return [
            'name' => 'required|string|unique:attributes,name,' . $this->attribute()->id . ',id' ,
            'values' => 'array',
               'values.*.id' => 'required|numeric|unique:values,id,' . $id_being_validated . ',id'          
        ];
    }

How do I get $id_being_validated?

Thank you for your help!

Aug
26
6 months ago
Activity icon

Replied to Dusk Test: Browser Apparently Works With Different DB

Thanks a lot @bearcodi

The :memory: was the catch... File based SQLite DB works fine, but it takes time. Single stupid simple test runs like 3-4 seconds. I can run 100 backend test in such time.

Any hints for speeding up Dusk tests?

Aug
25
6 months ago
Activity icon

Started a new Conversation Dusk Test: Browser Apparently Works With Different DB

My test

<?php

namespace Tests\Browser;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Hash;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class LoginTest extends DuskTestCase
{
    use DatabaseMigrations;

    /** @test */
    public function testLogin()
    {
        $user = factory(User::class)->create([
            'email' => '[email protected]',
            'password' => Hash::make('password'),
        ]);

        $this->browse(function ($browser) use ($user) {
            $browser->visit('/login')
                    ->type('input[name=email]', $user->email)
                    ->type('input[name=password]', 'password')
                    ->press('Login')
                    ->screenshot('login-page')
                    ->assertPathIs('/');
        });
    }
}

Generated screenshot says, there is no such table users, but if I dump Users::all() within the test code, it shows user correctly, using correct DB connection. I am wondering, how to set up the database for the browser, so I test against the same data I work with in my test?

Thanks in advance.