BillRiess

BillRiess

Member Since 4 Years Ago

Experience Points 17,185
Experience Level 4

2,815 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 199
Lessons
Completed
Best Reply Awards 1
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.

21 Mar
5 months ago

BillRiess left a reply on Running Out Of Memory PHPUnit CI/CD Pipelines

So oddly enough, this was resolved by adding: php artisan passport:keys to my pipeline. I'm not sure how this ever worked without the keys being set in the first place though...

BillRiess started a new conversation Running Out Of Memory PHPUnit CI/CD Pipelines

I'm getting this error in Bitbuckets Pipelines when running PHPUnit but not when I run PHPUnit locally...

PHPUnit 7.5.7 by Sebastian Bergmann and contributors.
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE  63 / 153 ( 41%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 126 / 153 ( 82%)
EEE

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /opt/atlassian/pipelines/agent/build/vendor/laravel/telescope/config/telescope.php on line 1

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /opt/atlassian/pipelines/agent/build/vendor/symfony/debug/Exception/FatalErrorException.php on line 1

Running locally, everything works.

Here is my phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>

        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="MAIL_DRIVER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
        <env name="DB_CONNECTION" value="sqlite_memory"/>
    </php>
</phpunit>

The sqlite_memory connection just points to :memory: based driver.

The TestCase.php:

<?php

namespace Tests;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication, RefreshDatabase;

    public function tearDown(): void
    {
        parent::tearDown();
        app()->forgetInstances();
    }
}

Pipelines gives 4gb of ram which should be plenty for the tests that are running. Again, locally there are no issues but on the Pipeline server there is. I'm wondering if maybe there is a config option or something I'm missing.

04 Mar
6 months ago

BillRiess started a new conversation Securely Handling Client_secret Passport

What is the best way to handle the client_secret in a first-party web or mobile application? Right now I have an API built in Laravel using Passport and a few first party consumers of this API. It is said to be insecure to leak or pass the client_secret in a web/mobile application but I don't know how you can request a password grant without passing the client_secret to /oauth/token. The only other way I can think of doing this would be to do a server-side curl request for the web (like a proxy) but this won't work in a mobile environment.

Is it safe to pass the client_secret to /oauth/client from a client-side call (via Axios)?

26 Feb
6 months ago

BillRiess started a new conversation Validation Request Vs Authorization Policy

Both Validation Requests and Authorization Policies seem to overlap when it comes to authorizing access in a Controller. Has anyone found one to be more useful than the other? In my current project I setup many Validation Requests to handle both authorization and input validation. I'm using this throughout my API Resource controllers. Should I be using Policies instead to handle the authorization or is that an unneeded step in my case? Just trying to understand which way would be considered a more ideal approach.

I should note, the authorization mostly revolves around custom Gate policies which are defined via Permissions.

21 Feb
6 months ago

BillRiess left a reply on Laravel Mail Does Not Send To Mailtrap

Try running your code in Homestead or Valet (if you're using a Mac) and see if you have the same issue. This should isolate the problem down to a missing system dependency or a code-related issue.

BillRiess left a reply on Laravel Mail Does Not Send To Mailtrap

You'll want to install postfix if its not installed. There are plenty of guides out there but you can get started with sudo apt install postfix.

BillRiess left a reply on Laravel Mail Does Not Send To Mailtrap

@TWITTLER - Is sendmail installed on the system?

BillRiess left a reply on Laravel Mail Does Not Send To Mailtrap

Try setting MAIL_ENCRYPTION to null

15 Feb
7 months ago

BillRiess left a reply on Encrypt A Password In Database Update

I would suggest using Hash::make($request->password) instead with the upcoming helper function changes.

BillRiess left a reply on How To Build An MLM Software With Laravel

It's certainly possible and with a year plus experience it should be do-able. I'm not sure what you're really looking for though. There are some open-source projects already started using Laravel as the backend to their MLM solution.

BillRiess left a reply on Remove Route Param From Being Passed To Controller.

@SNAPEY - In that case, @snapey, $patron would equal the client_id not the patron_id as intended.

BillRiess left a reply on Remove Route Param From Being Passed To Controller.

Well, its apart of a RESTful API so that wouldn't work. It's okay. I think I'll just keep the unused $client variable on the function.

BillRiess left a reply on Remove Route Param From Being Passed To Controller.

@JLRDW - So I validate the client in the UpdatePatron request using \Route::current()->parameter('client') so when I get to my Controller I don't need that variable to be passed. Now I have to ignore the variable for every method.

public function update(UpdatePatron $request, $client, $patron)

I just thought it would be cleaner if I could just have

public function update(UpdatePatron $request, $patron)

but I guess that's not possible unless I did something hacky to strip out the first param.

BillRiess left a reply on Remove Route Param From Being Passed To Controller.

@JLRDW - Wouldn't this affect the URL?

so /api/v1/clients/123/patrons/1 wouldn't work.

BillRiess started a new conversation Remove Route Param From Being Passed To Controller.

routes/api.php

Route::prefix('v1/clients/{client}')->middleware('auth:api')->group(function () {
    Route::apiResource('patrons', 'Api\PatronController');
});

app/Http/Controllers/Api/PatronController.php

...

public function update(UpdatePatron $request, $ONE, $TWO)
{
    ...
}

...

In my controller the {client} from the route and the {patron} are both being passed to the PatronController. $ONE=client_id and $TWO=patron_id. Is there a way to only pass {patron} and not the {client}? In my case, I have no need for the client_id and would prefer to not have the unused variable in my controller.

BillRiess left a reply on Workers Concurrency

How are your daemon workers setup/running? As @talinon said, Supervisor would be the ideal solution.

14 Feb
7 months ago

BillRiess left a reply on Big Shame For Laravel Community

Just curious, how is your platform different than http://larajobs.com?

12 Feb
7 months ago

BillRiess left a reply on Style Doesn't Load After Remove Public From Url In Laravel

I feel like you have your apache misconfigured. Apache should be pointing to the public folder, not the root Laravel folder. So the root directory would be your public folder, hence no need to "remove" it.

11 Feb
7 months ago

BillRiess left a reply on Style Doesn't Load After Remove Public From Url In Laravel

Why are you trying to prevent access to the public folder? It's purpose is to securely serve the css/js files as well as route all the traffic through the index.php.

06 Feb
7 months ago

BillRiess left a reply on Whoops Isn't Working... Whoops!

Does vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css exist?

BillRiess left a reply on Users Can Belong To A User And Have Many Users - How Do I Design This In The Database?

You also have CTEs in MySQL 8 but you will have to end up writing the queries yourself if you really really needed the performance - http://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/

Personally, I would just go with the nested set library and some smart caching.

05 Feb
7 months ago

BillRiess left a reply on Users Can Belong To A User And Have Many Users - How Do I Design This In The Database?

I would suggest using a nested set instead of a recursive approach. This is a pretty good library for handling it automatically for you: https://github.com/lazychaser/laravel-nestedset

BillRiess left a reply on Fastest Query? Count Rows In Relation After Where()

You could take a more Eloquent approach to this and use query scopes and cache results. This would boost performance on future calls, you can set up an observer to update the cache when new records are added/removed.

BillRiess started a new conversation Best API Approach For Non-resource

I'm curious what the general consensus is here as to the best approach for a non-resource API. I'm currently building a RESTful API using passport and everything is working great for my standard resources but I have a few things that don't exactly fit that scope. For example, one API call may be a timer which would have 2 endpoints start and stop. The start requires 2 additional parameters to be passed (things to be tracked by the timer) while the stop would just stop the active timer for that user. A user will only ever have 1 timer active at a time so no need to pass timerId.

Different ways to approach this:

GET: /api/v1/timer/start/{thing1ID}/{thing2ID}
GET: /api/v1/timer/start?thing1=123&thing2=abc
POST: /api/v1/timer/start
Form-body: [thing1 => <id>, thing2 => <id>]

The stop endpoint would just need to be called to end the timer, this could be through any of the http verbs.

I'm just looking for some general feedback here as to what would be the best approach for something like this.

04 Feb
7 months ago

BillRiess left a reply on Subscription

@MANELGAVALDA - Oops, you're correct! Sorry about that.

BillRiess left a reply on Subscription

@REALRANDYALLEN - The paypal url no longer works but I believe if you contact support they will still work with you on it.

30 Jan
7 months ago

BillRiess left a reply on How To Count Unique Website Visitor By Laravel 5.7 ?

As others have suggested, Google Analytics can provide this for you.

BillRiess left a reply on Running Console Command From Subfolder

You will likely need to register your commands path in app/Console/Kernel.php.

BillRiess left a reply on Still Unauthorized Using CreateFreshApiToken Middleware

@ouhare I had a very similar issue but for me it was related to my app/Providers/RouteServiceProvider.php which was using web middleware instead of api on the api calls.

BillRiess left a reply on Is There A Case To Keep "_token" As Part Of The Request?

I don't see what owasp has to do with this question though. Clearly, he is asking about removing the field after it has been validated, which means it is no longer going to be used for the rest of the request lifecycle. This also implies he understands its purpose. I do agree, however, that removing it does not gain any benefit whatsoever.

29 Jan
7 months ago

BillRiess left a reply on Online School For Web Development

There are some series on here that already cover the basics of OOP. While certain other languages may be more strict, I think modern PHP covers everything you need to understand OOP design.

This series would be a good start: https://laracasts.com/series/object-oriented-bootcamp-in-php

BillRiess left a reply on Is There A Case To Keep "_token" As Part Of The Request?

@travisobregon you're safe to remove it but really you don't need to - you don't gain anything by removing it after it has been validated. If you want to get a request object without the token you can just use request()->except('_token') or better yet, use request()->only('fields', 'you', 'want').

BillRiess left a reply on Online School For Web Development

I second Udemy if you're looking for things outside of the Laracast scope.

BillRiess left a reply on Still Unauthorized Using CreateFreshApiToken Middleware

Can you post your routes/api.php and app/Http/Kernel.php files?

28 Jan
7 months ago

BillRiess left a reply on Still Unauthorized Using CreateFreshApiToken Middleware

Is your api route using auth:api middleware?

BillRiess left a reply on Resulted In A `401 Unauthorized` Response: Token Validation Failed: 'kid' Is Missing In The JWT Token Header.

I'm not sure if you copy&pasted your code directly but you have a typo in $accesToken, it should be $accessToken.

BillRiess left a reply on Creating Default Object From Empty Value

You never specified what you need help with...

BillRiess left a reply on Manually Adding Users In Code?

If you only need name and email fields of your request you can simplify it by just calling

$input = $request->only('name', 'email');

then just use $input['name'] and $input['email'].

25 Jan
7 months ago

BillRiess left a reply on Buying New MacBook Pro - Options?

The touch-bar isn't that bad. It actually works in PHPStorm and gives you options to run your tests, commits and xdebug.

23 Jan
7 months ago

BillRiess left a reply on What Uuid Version Is Str::orderedUuid()?

@BOBBYBOUWMANN - Yeah I saw that when digging through it but how does it conform to UUID4 if it is not 100% random?

22 Jan
7 months ago

BillRiess started a new conversation What Uuid Version Is Str::orderedUuid()?

I'm trying to figure out what UUID version the helper Str::orderedUuid() is returning. It is timestamped, not completely random, which makes me think it is version 1 but diving through the code it seems to be generating version 4.

Can anyone help me understand what's happening with this helper?

18 Jan
7 months ago

BillRiess left a reply on How To Update The Existing Laravel Project With The Latest Libraries.

You can install socialite through composer. I would check out some of the series on this site to help bring you up to speed on how that all works.

17 Jan
7 months ago

BillRiess left a reply on Exception When Running "npm Run Watch-poll" After Upgrading To 5.7

Try removing vue out of your npm dependancies.

BillRiess left a reply on Exception When Running "npm Run Watch-poll" After Upgrading To 5.7

Post your webpack.mix.js and your package.json.

BillRiess left a reply on Exception When Running "npm Run Watch-poll" After Upgrading To 5.7

I had some weird issues with Vue still being called when using React as well. Have you tried deleting your node_modules folder and the package.lock.json file and doing a fresh npm install?

BillRiess left a reply on Multi Auth While One Guard Should Be Multi-tenant Plus Socialite

Well, you would need to start by creating a blog_user pivot that joins blogs and users. On Authentication, you'll need to check the blog being accessed and make sure the user exists in the pivot. Obviously, you'll also need to remove the unique constraint on the email column as well.

When using Socialite, you'll need to do the same check against the pivot. If the account exists, then you can use the existing account if not you can add a new record storing just the email.

BillRiess left a reply on Accessing Scss Variables In Javascript?

No but you could look at using something like PostCSS instead.

16 Jan
7 months ago

BillRiess started a new conversation Newer React Series

I think it would be great to dive into React again. I know in general the Laravel ecosystem has a somewhat strong opinion for Vue.js but React is still React and I feel like there are not many good resources (like Laracasts) for learning React. I think a good series would be tying something like Bulma or Tailwind together to make functional components.

14 Jan
8 months ago

BillRiess left a reply on Docker Series

+1

02 Jan
8 months ago

BillRiess left a reply on 401 Consuming Passport Via JS

@SUMANTAMIT - The point of the \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, middleware is that it appends the laravel_token cookie with the JWT in it.