threeel

threeel

Member Since 4 Years Ago

Experience Points 39,305
Experience Level 8

695 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 581
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

25 May
3 weeks ago

threeel left a reply on Policy Always Returns 403

hello guys thanks for your support i have found my issue. it was actually twofold case one was

Gate::before(function($user, $ability) {
            return $user->isAdmin();
        });

so if you where a normal user and not admin this naturally returns false so that makes the result false

Gate::before(function($user, $ability) {
            if ($user->isAdmin()) {
                return true;
            }

        });

so with this if a user is admin will return true else it will proceed to the policy

the second actually comes from a previous comment @wilburpowery

where i replied that the documentation says that you suppose to send a full class name if it is not receiving an instance

 public function view(User $user, Lecture $lecture)
    {
        return $user->isSubscribed();
    }

the documentation actually refers to the case of create ex.

    public function create(User $user)
    {
        //
    }

so thank you all for your comment.

21 May
4 weeks ago

threeel left a reply on Policy Always Returns 403

@DIEGOAURINO - hey thanks for the reply. i have checked the policies namespace/path i used hardcoded paths. the problem is not just on lecture

something that maybe "different" from the normal implementation is that i am using passport for api authentication.

i am using the Passport::actingAs($user); in the tests

also something that i have noticed is that on the AuthServiceProvider

i have the

Gate::before(function($user, $ability) {
            return $user->isAdmin();
        });

which it should be allowing the request if i was running as admin but still not working

threeel left a reply on Policy Always Returns 403

@DIEGOAURINO - hey thanks for the reply i have tried that with no success. keep in mind that this is laravel 5.8 that i shouldn't have to do this.

threeel left a reply on Policy Always Returns 403

@WILBURPOWERY - Hey thank you for the reply i was trying to do what says in the documentation for methods that don't have Models. https://laravel.com/docs/5.8/authorization#methods-without-models

i have tried with the way you suggested and no success. i have also removed the Model from the method

public function view(User $user) {
return true;
}

and still no success.

20 May
4 weeks ago

threeel started a new conversation Policy Always Returns 403

Hello all i have been having an issue while testing an api endpoint

i have tried introducing a policy into the project and still trying to figure it out the policy is

    /**
     * Determine whether the user can view the lecture.
     *
     * @param \App\Models\User $user
     * @param \App\Models\Lecture $lecture
     * @return mixed
     */
    public function view(User $user,Lecture $lecture) {
        return true;
    }

the controller

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function index() {
        $this->authorize('view',Lecture::class);

        return ['data','meta'];
    }

Test

    public function test_that_lectures_are_viewed_publicly() {

        $response = $this->getJson($this->getEndpoint('lectures'));

        $response->assertOk();
        $response->assertJsonStructure(['data', 'meta']);

    }

public function getEndpoint($endpoint, $append = null) {

        if ($append) {
            return $this->endpoint_prefix . $endpoint . '/' . $append;
        }

        return $this->endpoint_prefix . $endpoint;

    }

i have registered the Policy in the Auth Service provider

    protected $policies = [
        // 'App\Model' => 'App\Policies\ModelPolicy',
        Course::class           => CoursePolicy::class,
        Lecture::class          => LecturePolicy::class,
        SubscriptionPlan::class => SubscriptionPlanPolicy::class,
    ];

 /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot() {

        $this->registerPolicies();

        Passport::routes();

        Gate::before(function($user, $ability) {

            return $user->isAdmin();
        });
    }

problem is that i always get a 403 if anyone could help would appreciate it. Laravel 5.8 is used

21 Sep
8 months ago

threeel started a new conversation How To Create A Custom Create For A Nova Resource

I have Model that in order to be created it needs i need to call a static function on it. when i create my Nova Resource it is failing i assume because it should not be created the same way as the other models are created. is there any way that i can handle the creation of the model when Nova is doing the Post Request?

14 Apr
2 years ago

threeel left a reply on Can Laravel Spark Used For Open-source Public Project Hosted On Github?

-- Do you mean deliver enterprise features as plugins/packages that can be installed on community edition?

yes this is what i meant.

13 Apr
2 years ago

threeel left a reply on Spark API Authentication

you can use an Authorization header and use Bearer {your-token} on the value

18 Jan
2 years ago

threeel started a new conversation AWS QUEUE Listen

i am trying to listen to events that i didn't create on Amazon SQS. Does anyone know how would i be able to listen for that specific events on that queue.

The workflow is as follow. image is uploaded directly on S3 -> SNS -> SQS. i am trying to pick the event that it was created from my laravel app.

Thank you in advance!

01 Jun
3 years ago

threeel left a reply on Can I Map A Domain To A User Route?

@bobbybouwmann thank you for the gist it is partially what i am looking for and also thank you @Eluknow i have seen the documentation my question is how do i combine the above with the users private domain.

ex. www.username1.com -> username1.myapp.com www.username2.com -> username2.myapp.com

https://www.namecheap.com/support/knowledgebase/article.aspx/9247/2208/how-do-i-use-my-domain-with-my-tumblr-account

something like the link

threeel started a new conversation Can I Map A Domain To A User Route?

I am trying to see if it is possible to associate a user to a specific route. example: One User has the route username.mylaravelapp.com (username is route of his username) how can i allow the user to access the specific account based on a user domain? ex. username.com -> username.mylaravelapp.com does it need to be done in ngynx ? or can i do something in laravel. obviously this is going to be dynamic because there is many usernames in an app. thanks

21 Apr
3 years ago

threeel started a new conversation Spark User With Multiple Subscriptions

Can a User have multiple subscriptions in spark. how can this be achieved. ex.

$user->resource1->subscription
$user->resource2->subscription
etc.

11 Apr
3 years ago

threeel left a reply on How To Measure Login Request Per Resource For A Subscription

Yes you are right. thank you for your time!

08 Apr
3 years ago

threeel left a reply on How To Measure Login Request Per Resource For A Subscription

@bobbybouwmann Yes but in what part of the cycle does it get executed...

meaning that when i user logs-in i increment || decrement the model but the message might be in queue so the next login attempt will not have the right subscription connection count until the first connection gets out of the queue and executes...

07 Apr
3 years ago

threeel left a reply on How To Measure Login Request Per Resource For A Subscription

@bobbybouwmann Thank you for your reply and sorry for my late reply... i am trying to see how i can use a command bus and queues and keep everything in sync.... with $model->increment

05 Apr
3 years ago

threeel started a new conversation How To Measure Login Request Per Resource For A Subscription

Hello all i am trying to figure out the best way to handle a request counter and persist it. ok the scenario i have a resource for example.

/resource/{identifier}

the identifier is the id of the resource i want to measure how many times did this resource was hit and to persist it so that if on a next request the counter is equal to the maximum of users subscription to deny access to the resource.

i am looking for efficiency... i am aware that i can do

$model->increment('counter-property') 

the connections that i am expecting is around 3200/day on the same resource.

thank you for your time!

21 Feb
3 years ago

threeel left a reply on How To Create A Convenient Function? Is HasManyThrough Good For This?

wow that was simple... thank you very much!

threeel started a new conversation How To Create A Convenient Function? Is HasManyThrough Good For This?

i have 3 models

Callee
    id (int)
    name(string)

CalleeMetadata
    id (int)
    callee_id(int)
    callee_meta_type_id (string)
    value(string)
    timestamp

CalleeMetaType
    id (string)
    label(string)

i want to create a function from callee to metatypes and from metatypes to callee

i have tried using hasManythrough like

class Callee extends Model
{

    public function metadata(){
        return $this->hasMany(CalleeMetaData::class);
    }

    public function metatypes(){
        return $this->hasManyThrough(CalleeMetaType::class,CalleeMetaData::class,"callee_meta_type_id","id");
    }

}

but i get an empty collection any input is highly appreciated! thanks