Braunson

Founder at Geekybeaver

Member Since 6 Years Ago

Ontario, Canada

Experience Points
38,225
Total
Experience

1,775 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
46
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
38,225 XP
Jul
06
5 days 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 week 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
2 weeks 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
2 weeks 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
2 weeks 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
2 weeks 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
3 weeks 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
3 weeks 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

Activity icon

Replied to Scrapp Data Using Goutte

I wanted to mention, there is an API for this, why not use that instead of scraping, it may be much easier? https://lol.gamepedia.com/Help:API_Documentation

Jun
08
1 month ago
Activity icon

Replied to Manual Invoicing With Spark

Yes you'd have to do this manually and assign them a 'Free plan' of sorts.

You could also create a cron in your system and code to manually create an invoice for them via the Stripe API as well.

Activity icon

Replied to Error In User Account Management

The error is telling you no user is authenticated. It's likely because you haven't "logged the user in" yet.

Try dding auth()->check(), it'll likely output false.

Jun
04
1 month ago
Activity icon

Awarded Best Reply on Not Getting Scipt

->script will execute JS not a while file.

See this is how ->script() works https://github.com/laravel/dusk/blob/master/src/Concerns/InteractsWithJavascript.php

It executes the script via the driver (i.e. Chrome).

So to do what you want in the second code example, you'd have to get the file contents and insert that into ->script().

Jun
03
1 month ago
Activity icon

Replied to Calling Stripe's Javascript APIs From PHPUnit?

Check this out, it may point you in the right direction https://medium.com/@phpTechnocrat/how-to-use-laravel-dusk-to-test-stripe-cashier-c27471c0383

You may need a custom route/js to test with via Dusk

Activity icon

Replied to Click On Button In Dusk

Typically you'd use ->click('Weddings') but since there is multiple spans with "Weddings" (and html inside the button value), that likely why it doesn't work.

Question do you have 4 spans with the same wording inside your button? Try this instead.

<button class="department btn-dept show-for-plus-up" 
    id="wedding" 
    data-department="wedding" 
    data-ptags="occasion:wedding">
    Weddings
</button>

Not sure if show-for-plus-up is available but apply that on the button. Try running your Dusk code with ->click('Weddings') assuming that's the only button with the text of Weddings.

Activity icon

Replied to Laravel Signrequet APi

There's a few other packages: https://phppackages.org/s/signrequest

As for your error, it says the signrequest endpoint is missing signers and document parameters.

Activity icon

Replied to How Can I Solve Issue Of In_use In Mysql Table

Have you tried repairing the table?

REPAIR TABLE `table_name`
Activity icon

Replied to Dompdf - Image Not Found Or Type Unknown

How are you referencing the path to the logo? If the cron is running it from a different location and the image is defined via relative, it won't work.

Try defining the logo path as absolute and try again.

Activity icon

Replied to How To Create Multiple Notifications In Laravel

So you want to be able to support notifications in models other than Users?

The [docs](Docs: https://laravel.com/docs/7.x/notifications) outline how to do this.

Remember, you may use the Illuminate\Notifications\Notifiable trait on any of your models. You are not limited to only including it on your User model.

So you need to implement the Notifiable trait in your Staff class in order to use the notify feature.

Activity icon

Replied to Signal Messaging

I haven't seen a PHP lib/sdk for Signal.org but there's a JS one that may be of interest, you could either use that or use it to create your own PHP lib/sdk

https://github.com/signalapp/libsignal-protocol-javascript

Activity icon

Replied to Display Products Within An Order After Emptying Cart

Well to start you'd want to know the order id, say you have that you can get all items from the order and list them out using (what I presume you have setup) relations.

  1. Grab all items from an order
  2. Loop out the items in a view
  3. Use relations to get the product and order details
  4. Generate an HTML view (first step)
  5. Use a PDF library to convert the HTML view to a PDF using something like this https://github.com/barryvdh/laravel-dompdf
Activity icon

Replied to How To Use Shetabit/visitor In Laravel 7.0 Visitor Tracker

From the docs:

Automatic logging Your application can store visitor's log automatically using LogVisits middleware.

Add the Shetabit\Visitor\Middlewares\LogVisits middleware if you want to save logs automatically.

The middleware will store logs for models which has binded in router (router model binding) and has used Shetabit\Visitor\Traits\Visitable trait.

So open app/Http/Kernel.php and find the global middleware array protected $middleware = [

Then at the bottom of the array (inside the array) add this line:

Shetabit\Visitor\Middlewares\LogVisits::class,

It should look something like this..

    protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        \Fruitcake\Cors\HandleCors::class,
        \App\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
	Shetabit\Visitor\Middlewares\LogVisits::class,
    ];

That will apply the LogVisits middleware to all requests.

If you want it to be added to only specific requests you can add the same line but define the array key and put it in $routeMiddleware then you can call it on any specific route you want.

Activity icon

Replied to Not Getting Scipt

->script will execute JS not a while file.

See this is how ->script() works https://github.com/laravel/dusk/blob/master/src/Concerns/InteractsWithJavascript.php

It executes the script via the driver (i.e. Chrome).

So to do what you want in the second code example, you'd have to get the file contents and insert that into ->script().

Activity icon

Replied to Adding Custom Redirects To Routes File

Couldn't you use something like this in a route closure or even a controller method a route would point to?

return redirect()->away('https://foourl.com');
Activity icon

Replied to Cannot Use Homestead With Virtualbox For Over A 2 Weeks

Have you tried destroying the VM and re-creating it... vagrant destroy -f and vagrant up?

Also checkout this GitHub issue https://github.com/hashicorp/vagrant/issues/2157

Activity icon

Replied to Tinker Not Stopping In The Terminal

Looks like your code is invalid and missing a ' before the email..

->type('#login_email',[email protected]')

should be

->type('#login_email', '[email protected]')

Activity icon

Replied to Failed To Save File: Insufficient Permissions. Select 'Retry As Admin' To Retry As Administrator

Have you seen this thread? https://github.com/Microsoft/vscode/issues/57020

Try running code as sudo code

If you cannot save a file with VSCode it could mean that the place you moved the files to needs different user permissions.

Activity icon

Replied to Target Class [admin] Does Not Exist.

Can you post the full error stack?

May
29
1 month ago
Activity icon

Replied to A Facade Root Has Not Been Set.

Is this a fresh Laravel 7.x install, or are you upgrading from a previous version? What version are you using now?

Try running these first:

 php artisan config:cache
 php artisan config:clear
 php artisan cache:clear
 composer update
May
02
2 months ago
Activity icon

Replied to Problem With Storage In Homestead

Did you run the storage link command?

See https://laravel.com/docs/7.x/filesystem#the-public-disk

php artisan storage:link

Apr
14
2 months ago
Activity icon

Replied to Problems With Arrays

It's displaying hello once because your using return. The return ends the loop. Instead try echo 'hello';