Rotario

Rotario

Member Since 3 Months Ago

Experience Points
130
Total
Experience

4,870 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.

Level 1
130 XP
Jun
22
1 month ago
Activity icon

Replied to API Nested Shallow Resource Policy Not Registering Correctly?

Ah - brill thanks! That sorted it

Jun
21
1 month ago
Activity icon

Replied to API Nested Shallow Resource Policy Not Registering Correctly?

Hi Tippin, Yeah I spotted that once I'd posted this, have changed those - to no avail! Is there any way to debug whether the policy is even being called? I can't see it in the stack trace.

[
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
    "line": 198,
    "function": "prepareException",
    "class": "Illuminate\Foundation\Exceptions\Handler",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/app/Exceptions/Handler.php",
    "line": 57,
    "function": "render",
    "class": "Illuminate\Foundation\Exceptions\Handler",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
    "line": 51,
    "function": "render",
    "class": "App\Exceptions\Handler",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 172,
    "function": "handleException",
    "class": "Illuminate\Routing\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
    "line": 41,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Routing\Middleware\SubstituteBindings",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
    "line": 59,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Routing\Middleware\ThrottleRequests",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
    "line": 44,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Auth\Middleware\Authenticate",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/sanctum/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php",
    "line": 32,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 128,
    "function": "Laravel\Sanctum\Http\Middleware\{closure}",
    "class": "Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
    "line": 76,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Middleware\VerifyCsrfToken",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
    "line": 116,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
    "line": 62,
    "function": "handleStatefulRequest",
    "class": "Illuminate\Session\Middleware\StartSession",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Session\Middleware\StartSession",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
    "line": 37,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
    "line": 66,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Cookie\Middleware\EncryptCookies",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/sanctum/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php",
    "line": 25,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 149,
    "function": "Laravel\Sanctum\Http\Middleware\{closure}",
    "class": "Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 103,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/sanctum/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php",
    "line": 33,
    "function": "then",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 103,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
    "line": 687,
    "function": "then",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
    "line": 662,
    "function": "runRouteWithinStack",
    "class": "Illuminate\Routing\Router",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
    "line": 628,
    "function": "runRoute",
    "class": "Illuminate\Routing\Router",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
    "line": 617,
    "function": "dispatchToRoute",
    "class": "Illuminate\Routing\Router",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
    "line": 165,
    "function": "dispatch",
    "class": "Illuminate\Routing\Router",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 128,
    "function": "Illuminate\Foundation\Http\{closure}",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
    "line": 21,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
    "line": 21,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
    "line": 27,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
    "line": 63,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/fruitcake/laravel-cors/src/HandleCors.php",
    "line": 37,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Fruitcake\Cors\HandleCors",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/fideloper/proxy/src/TrustProxies.php",
    "line": 57,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Fideloper\Proxy\TrustProxies",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 103,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
    "line": 140,
    "function": "then",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
    "line": 109,
    "function": "sendRequestThroughRouter",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
  },
  {
    "file": "/home/vagrant/code/machinedown/public/index.php",
    "line": 55,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
  }
]

R

Jun
20
1 month ago
Activity icon

Started a new Conversation API Nested Shallow Resource Policy Not Registering Correctly?

Hi All, I've got an API nested resource like so:

api.php

Route::apiResource('sites.machines', 'API\MainMachineController')->shallow();

and the controller uses: API/MainMachineController.php

public function __construct()
    {
        $this->authorizeResource(MainMachine::class);
    }

to register its policy. Now the POST to /sites/1/machines is authorized as expected, but when I instead try to PUT to /machines/1 to update the resource, I get a forbidden error, even if I just stick a return true; in the corresponding update method in the policy function like so: MainMachinePolicy.php

    public function update(User $user, MainMachine $mainMachine)
    {
        return true;
    }

Now looking at php artisan route:list It seems as if the model isn't registered correctly on the policy on the non-nested routes. I think this may be a bug?

|        | POST      | api/sites/{site}/machines   | sites.machines.store | App\Http\Controllers\API\[email protected]                   | api,auth:sanctum,can:create,*App\MainMachine*  |
|        | GET|HEAD  | api/sites/{site}/machines   | sites.machines.index | App\Http\Controllers\API\[email protected]                   | api,auth:sanctum,can:viewAny,*App\MainMachine*

|        | PUT|PATCH | api/machines/{machine}      | machines.update      | App\Http\Controllers\API\[email protected]                  | api,auth:sanctum,can:update,*main_machine*     |
|        | GET|HEAD  | api/machines/{machine}      | machines.show        | App\Http\Controllers\API\[email protected]                    | api,auth:sanctum,can:view,*main_machine*       |
|        | DELETE    | api/machines/{machine}      | machines.destroy     | App\Http\Controllers\API\[email protected]                 | api,auth:sanctum,can:delete,*main_machine*     |
Apr
19
3 months ago
Activity icon

Replied to Sanctum Csrf Route Not Registered, But Backend Works

Sorted, it's csrf-cookie not token!

Apr
18
3 months ago
Activity icon

Started a new Conversation Sanctum Csrf Route Not Registered, But Backend Works

Hi, Just a quick question - I've installed sanctum with composer require, then done the php artisan vendor publish. the whole token backend works, can request a token using my own route with sanctum middleware and returning a token. When i try to use the Auth /login endpoint it gives me CSRF token mismatch error, as expected. For some reason the GET /sanctum/csrf-token endpoint returns a 404. I've tried reinstalling sanctum and republishing, but it's weird that the routes haven't been registered but I can call createToken and the backend DB exists any ideas please? Appreciate your help