reviewdevs

reviewdevs

Member Since 1 Month Ago

Experience Points
9,640
Total
Experience

360 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
93
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.

Level 2
9,640 XP
Sep
23
1 month ago
Activity icon

Replied to Which Is Better, Spatie Permissions & Roles Or Using Middlewares Or Policies?

I was thinking that Spatie would give me more flexibility along with Policies, like saying


// In CourseController

public function getAllVideos(User $user, Course $course) { 
    self.authorize('getVideos', $course);

    return $course->videos;
}

and then in a CoursePolicy.php file i'd say

public function getVideos(User $user, Course $course)
{
	return $user->hasRole('super-admin') || $user->hasRole('tutor') && $course->author->is($user) || $user->hasRole('learner') && $user->purchasedCourses->has($course);
}

this is more verbose and clear about the intent of what am trying to do

but am not sure if that respects the open closed principle because what if i wanted to make a new role like a subscribed user, i'd have to go to this function and edit it

but at the same time, if i wanted to add a new role and some permissions to it, i'd do that easily from a dashboard or something

however if I go with a middleware approach

i'd just say

public function handle($request, Closure $next)
{
    if ($request->user() && $request->user()->type != 'admin')
    {
        return new Response(view('unauthorized');
    }
    return $next($request);
}

and assign that middleware on some route

which is easier, but not can't be set from a dashboard

so that was confusing me and i thought of asking for some opinions and maybe some tips

Activity icon

Started a new Conversation Which Is Better, Spatie Permissions & Roles Or Using Middlewares Or Policies?

Hello, am trying to make something like Udemy as practice after finishing some courses here on Laracasts

I'm trying to fix a problem where I want to allow users who purchased a course to view it, if not, they get 401

I was thinking of two approaches, either using Policies combined with Roles and permissions

like saying

if user can view any course, then respond to him with the courses videos

else, check if user has this course in his purchased courses, then send him the course videos

else, unauthorized

that was the the Policies + roles & permissions approach

but i read that u can do so with Middlewares and it seemed easier to do it with middlewares from this article

https://justlaravel.com/middleware-laravel-content-restriction-user-role/

so i was wondering if someone could explain to me which is better and more scalable in the future

thanks a lot!

Sep
22
1 month ago
Activity icon

Started a new Conversation How To Handle Authorization If You Have Many To Many Based Roles And Permissions

I wanted to make roles and permissions to be as dynamic as possible, here is what I made on Diagram.io

https://drive.google.com/file/d/1NNyFpZZLiIhQwFgVnX26dgm-v7Ar8Th_/view?usp=sharing

however I was wondering how would I handle if user is authorized to do some action in Laravel

Sep
19
1 month ago
Activity icon

Commented on Model Tests

If anyone is using Laravel 8 and faced a problem with the Unit test where it doesn't understand what is $this->faker->sentence

change this line in the Unit test file

from: use PHPUnit\Framework\TestCase; to: use Tests\TestCase;

Activity icon

Replied to From IOS Development To Backend

@app_dev thanks a lot, I just found out there was a tab on Laracasts called Journey with steps of how to learn more, I skimmed through PHP and OOP since I already know both, and currently am learning building birdboard through TDD, only skipping front end part and replacing it with Restful APIs

Activity icon

Replied to From IOS Development To Backend

@app_dev thank u for replying, What i meant is am not interested in building the website's frontend, I meant that am only interested in building Restful APIs so i don't want to waste time building UI, so am looking for topics that explains just that

Activity icon

Started a new Conversation From IOS Development To Backend

Hello, I'm an iOS Developer with 3 years of experience, I wanted to shift to backend and build only restful apps without doing any HTML nor CSS as I would prefer my front end to be building the iOS apps and not websites

So I was wondering which topics should I see on Laracasts, thanks :))