Braunson

Founder at Geekybeaver

Member Since 6 Years Ago

Ontario, Canada

Experience Points
39,925
Total
Experience

75 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
121
Lessons
Completed
Best Reply Awards
49
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 8
39,925 XP
Aug
08
1 day ago
Activity icon

Replied to Mix Documentation Wrong/outdated ?

No it is correct, I can confirm as I use .version() and it does indeed hash my .js/css files. What does your Laravel Mix webpack file look like, can you post it? also what version of Laravel Mix do you have in your package.json/package-lock.json?

Aug
02
1 week ago
Activity icon

Awarded Best Reply on Laravel - Collection Of Routes With Modification From Str::of

Just a suggestion, check out how Laravel does this (already) via the php artisan route:list command.

See the code here https://github.com/laravel/framework/blob/eacc34162b4cd7c1648f3029e8861e3add01f9ef/src/Illuminate/Foundation/Console/RouteListCommand.php

Aug
01
1 week ago
Jul
30
1 week ago
Activity icon

Replied to String Given Notification

@browniecoffee Are you calling showReply method directly from a route? What does it look like?

Activity icon

Replied to Sanctum Or Passport

Depends on the requirements of your project.

There is a great video about the differences of each https://www.youtube.com/watch?v=LE1TC4WS4CY.

Passport provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. It is therefore necessary to have a brief knowledge of OAuth2.

Sanctum it is a simple package to issue API tokens to your users without the complication of OAuth. Sanctum uses Laravel's built-in cookie based session authentication services.

Activity icon

Replied to Old And Error Data Not Showing In Blade In Redirect Back With Input And Validator

What does your view look like. It's up to you in the view to display the error bag.

See https://laravel.com/docs/7.x/validation#quick-displaying-the-validation-errors

You will need something like this in your view that your redirecting back to:

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
Activity icon

Replied to (Cache) Get Expiration Remaining By Key ?

As far as I know there is no build in way to do this. Looks like there is a laravel/framework tissue on this https://github.com/laravel/framework/issues/13772 that was updated recently.

Activity icon

Replied to Separate Table Or 'signature' Column On Each Table?

Depends if your saving signatures for re-use. Having one signature per for vs multiple signatures changes things.

One signature per form - One (form) has One (siagnture) Multiple signatures per form - One (Form has many (Signatures)

It also depends what data your saving with the signature which will change how you'll want to save it. If your saving other data like, IP, signature, date, etc, a separate table is likely good to have that would belong to the form form_signature

Activity icon

Replied to String Given Notification

The error tells you exactly what the issue is.

The method showReply the second parameter is expecting (via type hinting) $notification to be an instance of DatabaseNotification class, but instead it's getting a string.

Check the parameters your passing to showReply and make sure the second parameter is an instance of the DatabaseNotification class. Don't forget to import/use it in the class containing showReply.

Jul
27
1 week ago
Activity icon

Replied to Page Settings In Chrome

I don't think that's possible from the page side, it's browser-to-browser dependent.

Jul
26
2 weeks ago
Activity icon

Awarded Best Reply on How To Show The Most Downloaded Pictures Within A Week

You need to record the "download" date, from there you can determine a "between" timeframe and use the whereBetween Eloquent helper.

Activity icon

Replied to How To Show The Most Downloaded Pictures Within A Week

You need to record the "download" date, from there you can determine a "between" timeframe and use the whereBetween Eloquent helper.

Jul
24
2 weeks ago
Activity icon

Replied to Updating A Request

Not entirely sure the context but you can merge an array into the requests array using merge. For example:

$request->merge([ 
    'contact_id' => 1,
    'user_id' => 2
]);

Works almost the same as PHP's array_merge.

If you need to create a new row in the db using Models for each pos* item, you could grab all array keys that start with pos and then iterate through them, something like this:

$filtered = array_filter($request->all(), function ($key) {
    return strpos($key, 'pos') === 0;
}, ARRAY_FILTER_USE_KEY);

foreach ($filtered as $pos) {
    // Do something
    SomeModel::create([
        'race_id' => $request->race_id,
        'user_id' => auth()->id(),
        'pos'     => $pos
    ]);
}

Hope this helps!

Jul
23
2 weeks ago
Activity icon

Replied to Updating A Request

Try using the merge method.

Jul
20
2 weeks ago
Activity icon

Replied to Where Should I Configure Trusted Proxies?

Check out this article that documents the config https://laravel-news.com/trusted-proxy

Jul
17
3 weeks ago
Activity icon

Awarded Best Reply on How To Get Results Of `Explain` Query In Laravel ?

You need to select the raw query..

DB::select(DB::raw('explain select * from "cats" where ("keywords")::jsonb @> forum'));
Activity icon

Replied to How To Get Results Of `Explain` Query In Laravel ?

You need to select the raw query..

DB::select(DB::raw('explain select * from "cats" where ("keywords")::jsonb @> forum'));
Jul
16
3 weeks ago
Activity icon

Replied to Forge Custom Provider With Custom Port

https://forge.laravel.com/docs/1.0/accounts/cookbook.html#forge-is-unable-to-access-git-repository

There are several reasons Forge may not be able to access your GitHub, GitLab or Bitbucket repository. First, you should try refreshing the source control API token that is linked to Forge via your account profile's "Source Control" tab.

Forge attempts to access your repository using your source control provider's API. The API credentials that will be used are the credentials tied to the account of the person who owns the Forge server. Note that if the Forge server is shared with you via a circle, it will use the circle owner's API credentials. You should ensure this person has full access to the repository on GitHub.

Also if it's under an organization, you need to grant Forge access to the organization to access the repository.

If all else fails, see if you have auth logs for Gitlab or contact Forge for help with the port.

Jul
14
3 weeks ago
Activity icon

Replied to Copy Vendor Folder Via Ftp

Looks like your composer lock file is referencing a package that is not on the FTP server.. specifically infyomlabs/laravel-generator.

Did you copy your vendor folder over to the server?

Activity icon

Replied to Tailwindcss Height Animate Transition Using Alpinejs

Take a look at this tutorial https://www.jesper.dev/posts/creating-a-dropdown-with-alpinejs/ :)

Specifically this part:

x-transition:enter="transition-transform transition-opacity ease-out duration-300"
x-transition:enter-start="opacity-0 transform -translate-y-2"
x-transition:enter-end="opacity-100 transform translate-y-0"
x-transition:leave="transition ease-in duration-300"
x-transition:leave-end="opacity-0 transform -translate-y-3"
Activity icon

Replied to Composer Error

We'll need more information than this. Is this a fresh Laravel app. What's the stack trace?

Not sure if your using this package but exact same error here https://github.com/botman/driver-facebook/issues/98

Possibly you are missing an .env key for Facebook?

Activity icon

Replied to CTO Is Strongly Pushing Selenium For Testing, What Are Your Thoughts?

I'd suggest you use what suits your needs, and your experience. If you are experienced with Dusk and it suits the requirements, then by all means use that, why be forced to learn Selenium if it's not needed. Sounds like the CTO is opinionated and likely has prior experience with Selenium.

The important question to ask:

  • is he working on the code base or building any tests?
  • what are his reasons for using Selenium instead of Laravel Dusk?

The difference between Dusk and Seleium are:

Dusk:

  • PHP
  • Browser Automation
  • Used for browser automation and testing API
  • Does not support Fixtures, Group fixtures, Generators unlike Selenium

Selenium:

  • Python
  • Web Automation
  • Used for testing web applications
  • Supports everything Dusk dues in addition to Fixtures, Group fixtures, Generators.

Other than that they are pretty much the same. Depends on what you are testing and your requirements really.

Jul
11
4 weeks ago
Activity icon

Replied to PHPUnit Alias Windows

@oleonides You have many options:

  1. Create an alias in Windows like @paparascal2020
  2. Using composer, globally install phpunit so you access to phpunit
  3. Create a composer "script" in the composer.json file. Like so.. (you would run composer phpunit or whatever the key value you set it.
{
    "scripts": {
        "phpunit": "vendor/bin/phpunit"
    },
}
Jul
06
1 month ago
Activity icon

Replied to File Uploads Failing On The Server

Looks like your trying to read a directory? (Notice in the error Is a directory).

Activity icon

Replied to How To Cancel $timeout Function After Load Response In It Angular Js

This is in the docs.. https://docs.angularjs.org/api/ng/service/$timeout

To cancel a timeout request, call $timeout.cancel(promise).

In tests you can use $timeout.flush() to synchronously flush the queue of deferred functions.

Jun
30
1 month ago
Activity icon

Replied to How To Get Latest In This Case?

@danlog You can lazy load with a closure. Something along these lines.

return new GroupResource(
    $group->load(['messages.user', function($query) {
        $query->orderBy('created_at'); // or $query->latest(); depending on what you want to do.
    }])
);
Jun
26
1 month ago
Activity icon

Awarded Best Reply on How To Run Npm Run Production From Model Class

While not ideal, you can use exec to execute the command.

Activity icon

Replied to How To Run Npm Run Production From Model Class

While not ideal, you can use exec to execute the command.

Jun
24
1 month ago
Activity icon

Replied to Laravel Inertia Js Error

The "u" is from undefined. Can you try logging app.dataset.page and see what returns, I have a feeling that may be the cause, dataset or page of the app object isn't defined.

Make sure you include <div id="app"></div> In your layout blade file.

Activity icon

Replied to Customizing Sanctum Unauthorized Response

If we take a look at the package's repo, specifically the src/Guard.php you'll see it's using (by default) the web guard, unless you set a specific guard in config/scantum.php line with guard.

So you can either override/modify the Authenticate.php middleware to output the message you want OR catch the AuthorizationException to output the message you want in the Exception/Handler

eg.

public function render($request, Exception $exception)
{
    if ($exception instanceof AuthorizationException) {
        return response()->json([
         'message' => 'your error message'
        ],401);
    }

    return parent::render($request, $exception);
}

Something along those lines :)

Activity icon

Replied to How To Go Incorporate Different Projects Into One?

This is a big conversation. It's hard to give advice on combining multiple projects without knowing the scope, functionality, requirements, etc.

If you want to have one "authentication gateway", you could just create an oAuth server with Laravel Passport and have all sites authenticate through that but they are still separate standalone sites.

It's hard to answer your question about using one database, scalability without more in-depth detail on what each site does, the requirements, functionality and scope. That you have to decide based on those factors.

Jun
23
1 month ago
Activity icon

Replied to Working With Large Xml/xlsx Files ?

Suggestions (some you already have done)

  • Upload file to server
  • Queue process
  • Chunk things
  • You could use updateOrCreate but I see you have a comment about checking diff between old/new data
  • Index the data
Activity icon

Replied to Confirming Successful Stripe Checkout Payments In Laravel

Your guide is https://stripe.com/docs/webhooks

So webhooks just take in the "success" from the Stripe end, what you do with it or need to do with it is up to you.

.......

You need to setup a webhook on a Laravel endpoint that's publicly accessible, then go to Stripe and set the Webhook URL for your user to that URL.

Next look at the package, follow the steps to install and this part is important...

Route::stripeWebhooks('webhook-route-configured-at-the-stripe-dashboard');

Finally, take care of the routing: At the Stripe dashboard you must configure at what url Stripe webhooks should hit your app. In the routes file of your app you must pass that route to Route::stripeWebhooks

This you would update with the webhook url you put in Stripe as the webhook.

Then under the package's Usage it shows how to handle webhook requests using jobs or an event listener (also displayed in the package Usage area of the docs). You can specify 'events' to specific jobs.

You'll want to likely use the events checkout.session.completed or checkout.session.async_payment_succeeded (both taken from the Stripe API event types docs linked above) depending on what you are looking to do.

So assuming you want to use Listeners for the event checkout.session.completed you'd do this:

  1. Create an event listener
  2. Add the event -> listener relation in the Event Service Provider
  3. Setup the webhook URL in your routes file.
  • Update your EventServiceProvider and add this..
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    'stripe-webhooks::checkout.session.completed' => [
        App\Listeners\StripeCheckoutSessionCompleted::class,
    ],
];
  • Create this app\Listeners\StripeCheckoutSessionCompleted.php with the following code:
<?php

namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Spatie\WebhookClient\Models\WebhookCall;

class StripeCheckoutSessionCompleted implements ShouldQueue
{
    public function handle(WebhookCall $webhookCall)
    {
        // do your work here

        // you can access the payload of the webhook call with `$webhookCall->payload`
    }
}

Update the handle method with your logic..

We highly recommend that you make the event listener queueable, as this will minimize the response time of the webhook requests. This allows you to handle more Stripe webhook requests and avoid timeouts.

  • Setup the webhook URL in your routes file
Route::stripeWebhooks('stripe-webhooks');
  • Go to Stripe and update the webhook endpoint to be yourapp.com/stripe-webhooks

Now your done.

Activity icon

Replied to Enable Enchant Spelling In PHP?

I've never used the extension but installing it into your local instance is easy, check out this article on installing it:

https://zoomadmin.com/HowToInstall/UbuntuPackage/php-enchant

As for making use of it within your TinyMCE Editor, you'll have to look into how to use the extension.

Jun
22
1 month ago
Activity icon

Replied to Add Global Mail Recipient To .env File And Acces It By A Controller.

Sure. Right now your config/mail.php stores a global "from" if it's not defined in the Mailable.

Look here https://laravel.com/docs/7.x/mail#configuring-the-sender then scroll down to the below heading Using A Global from Address.

If you want to make these env variables, you can do that also using the env helper!

Jun
18
1 month ago
Activity icon

Replied to Is Homestead 10.0 Beta Broken?

I'm using Homestead (latest) and utf8mb4 with no issue. I do not use Sequel Pro but are you sure it isn't Sequel Pro's issue? I've noticed in Sequel's GitHub issue area there are a few tickets related to utf8mb4.

Activity icon

Replied to The Use Of Cache In The Laravel Project

Just a thought on simplicity, rather than do this manually, why not using something like this package which will automatically take care of caching your models (updating/deleting/adding/etc)

https://laravel-news.com/laravel-model-caching

That way you don't have to worry about it inside your controller as it's managed on the Model level.

Jun
15
1 month ago
Activity icon

Replied to Using Multiple Tables For Authentication

Best option: use a role plugin.

Use one table for users, another for roles. Users have a role (one), or if you need users to have multiple roles, use a pivot table.

Take a look at this plugin https://github.com/spatie/laravel-permission

Jun
11
1 month ago
Activity icon

Replied to Authentication With Third Party API

You need to add logic in order to catch the RequestException and check that the status code is 401, then deal with it accordingly, otherwise, save the token to the DB and do what you need.

Check out this post, some of the answers will give you a better idea on how to catch and handle the 401 https://stackoverflow.com/questions/25040436/guzzle-handle-400-bad-request

Activity icon

Replied to Target Class Not Found.

What is the path of the admin view... i.e. resources/views/admin.blade.php?

What is the code your using to display the view?

Activity icon

Replied to Favorite 3rd Party Paid/free Services To Use With Laravel

I make use of S3, Laravel Forge, Twilio, Sentry (for a few projects) and PostMark.

S3 for easy file store on projects that need to scale but have file uploads, this way I can spin up new instances automatically and not worry about local file loss.

Laravel Forge (while not 3rd party necessarily) is super handy in spinning up new servers, sites, configuring the db, etc.

Twilio for sending out texts and calls easily and cheaply.

Sentry for logging/debugging a large production app easier.

PostMark for sending out transactional emails

Activity icon

Replied to Are There Any Fuzzy Search Packages For Laravel That Support Pagination?

You can paginate with the plugin via simplePaginate, a quick search of the issues of the package returned this https://github.com/TomLingham/Laravel-Searchy/issues/51#issuecomment-238023701

Also checkout this package

Activity icon

Replied to Error 419 Expired Page

Use {{ csrf_field() }} or @csrf inside your <form> tags. Check your config/session session lifetime. Clear your cookies and try again. Make sure your route your submitting to is protected by the web middleware. If your using SSL/HTTPs, make sure secure in the session config is set totrue.

Activity icon

Replied to Target Class [web] Does Not Exist.

When you say crashes, what happens? Do you get an error? What's your middleware look like?

  • Post your middelware
  • Post your Kernel.php
  • Post your full stack from you error
Activity icon

Replied to How To Get Maths And Physics Equations In Tinymce?

The best thing to do is create a custom plugin to take in data by the user and output the string you want. Check out the docs https://www.tiny.cloud/docs/advanced/creating-a-plugin/

Checkout this Math plugin if it suits your needs: http://www.wiris.com/en/solutions/tinymce

Activity icon

Replied to MySQL Issues

Check this answer out (the bottom) https://bugs.mysql.com/bug.php?id=86590 - it could be caused from a previous installation.

Activity icon

Replied to Laradock: Unknown Database 'homestead'

In your docker-compose.yml, what is the MYSQL_DATABASE value? That will be your database name,

The error means your DB doesn't exist.

Next step after checking the yml file, is to login as Root and get a list of DB's available to see what's there: https://laradock.io/documentation/#mysql-root-access