retaxmaster

Member Since 1 Month Ago

Experience Points
170
Total
Experience

4,830 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
0
Lessons
Completed
Best Reply Awards
0
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 1
170 XP
Apr
16
2 weeks ago
Activity icon

Replied to How To Pass Null Argument To Laravel Factory?

Yes, in the migrations the columns are nullable (and default null)

Activity icon

Started a new Conversation How To Pass Null Argument To Laravel Factory?

I've got a Factory definition like this:

public function definition() {

        $to = $this->faker->numberBetween(1, 3);

        return [
            "ad_id" => $to == 1 ? Ad::all()->random()->id : null,
            "delivery_id" => $to == 2 ? Delivery::all()->random()->id : null,
            "group_event_id" => $to == 3 ? GroupEvent::all()->random()->id : null,
        ];;
        
}

Basically, there are 3 fields, but just one can be defined, if one is defined, the others must be null, the factory uses faker to decide it, but now, I want to set which I want from the seeder:

MyModel::factory()->create([
      "ad_id" => null,
      "delivery_id" => 5,
      "group_event_id" => null,
]);

But this doesn't work, the factory ignore my null parameters that I'm passing for the other fields and set random Id's for the both null parameters. How can I solve it?

Mar
13
1 month ago
Activity icon

Replied to How To Create A Client For Authorization Code Grant With PKCE In Laravel Passport?

Ohhh I understand, so what happens if I want to my users can create clients to consume my API? Like Spotify, PayPal or Facebook for developers, where you can create clients and ask for tokens to consume their API's.

I understand that the Authorization Code Grant flow can do this, but why can't I use Authorization Code Grant with PKCE to do this? Thanks for your answer!

Mar
12
1 month ago
Activity icon

Started a new Conversation How To Create A Client For Authorization Code Grant With PKCE In Laravel Passport?

I'm trying to implement the **Authorization Code Grant with PKCE ** flow in Laravel Passport. Its documentation says that I have to use this command:

php artisan passport:client --public

That's fine, but I have to do it manually, I want to create those clients automatically, I mean, bring to my users a dashboard where they can create their clients. For that, I need to call through Ajax (or fetch) from my frontend some endpoint of Laravel Passport who allows me to create PKCE clients, but I don't know which endpoint call.

Laravel Passport provides the POST /oauth/clients endpoint to create clients, but this only create Authorization Code Grant Clients (without PKCE) and I don't know how to specify to create a PKCE client (same problem for Password Grant Tokens clients).

I was searching in the Laravel Passport's Client Controller and I realized that I can't specify what kind of client I want, this is the store method of Laravel Passport's Client Controller:

public function store(Request $request) {

	$this->validation->make($request->all(), [
	    'name' => 'required|max:191',
	    'redirect' => ['required', $this->redirectRule],
	    'confidential' => 'boolean',
	])->validate();

	$client = $this->clients->create(
	    $request->user()->getAuthIdentifier(), $request->name, $request->redirect,
	    null, false, false, (bool) $request->input('confidential', true)
	);

	if (Passport::$hashesClientSecrets) {
	    return ['plainSecret' => $client->plainSecret] + $client->toArray();
	}

	return $client->makeVisible('secret');
	
}

As you can see, in the create() method of the client, values are "hard-coded" preventing me to create another kind of client through the JSON API.

Also, I was searching in the Laravel Passport's Client Model and I realized that, with the model I can specify what kind of grants I want for that client:

protected $casts = [
	'grant_types' => 'array',
	'personal_access_client' => 'bool',
	'password_client' => 'bool',
	'revoked' => 'bool',
];

So, there have to be a way to create clients for any type of grants (like PKCE), but I don't know how.

Should I override the Laravel Passport's Client Controller? How can I do it? I know that I can use the model to create my own clients in my own endpoint, but I want to keep the POST /oauth/clients route, so I would need to override the Laravel Passport's Client Controller, but I don't know how, can you help me, please?