Member Since 8 Months Ago

Experience Points

4,080 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
Best Reply Awards
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.


    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
5,920 XP
3 weeks ago
Activity icon

Started a new Conversation Troubles Using Env And Config With Console Commands

With Laravel 6.2, PHP 7.4, on Ubuntu 18 LTS I'm having trouble using env and config in production. Locally, since I do not cache my config, I am able to use env with Console Commands. However in production with a cached config, both env and config return nulls when running a command.

These same variables work when accessed via a web route

$ php artisan config:clear
Configuration cache cleared!

$ php artisan scratch
^ "my-s3-bucket"
^ null

$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!

$ php artisan scratch
^ null
^ null

Here is the command


namespace App\Console\Commands;

use App\Models\Publication;
use Aws\S3\S3Client;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\Process\Process;

class Scratch extends Command {
   * The name and signature of the console command.
   * @var string
  protected $signature = 'scratch';

   * The console command description.
   * @var string
  protected $description = 'Command description';

   * Create a new command instance.
   * @return void
  public function __construct() {

   * Execute the console command.
   * @return mixed
  public function handle() {

I am using to deploy apps

So the .env file is symlinked to ../../shared/.env. If I cat .env it shows the variables correctly and again the web app works fine, this is limited to only console commands.

It is a fairly simple deploy.php

namespace Deployer;

require 'recipe/laravel.php';

// Project name
set('application', 'my-app');

// Project repository
set('repository', '[email protected]:my-app/my-app.git');

// tty breaks github actions
set('git_tty', false);

// Shared files/dirs between deploys
add('shared_files', ['.env']);
add('shared_dirs', ['storage']);

// Writable dirs by web server
add('writable_dirs', [

// Hosts

  ->set('deploy_path', '~/{{application}}');

// Tasks

task('build', function () {
  // run('cd {{release_path}} && build');

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');

task('restart supervisor', function() {
  run('sudo /etc/init.d/supervisor restart');

What steps am I missing or proper way to access an environment var via console?

1 month ago
Activity icon

Started a new Conversation General Error: 1366 Incorrect String Value: '\xE2?

I am parsing a text file which is encoded in UTF-8 and there is a string with the value of Cluse La Boh?⿿me Grey Leather 38mm When I view it in Notepad++ it looks like Cluse La Boh?xE2?xBFme Grey Leather 38mm

First of all, clearly something is wrong and I'll work with the client to fix the feed, however I'd rather it still be something I can save via Eloquent

I have verified mysql8 has the characterset set to utf8mb4 with

SELECT * FROM information_schema.SCHEMATA 
WHERE schema_name = "testapp";

SELECT CCSA.* FROM information_schema.`TABLES` T,
WHERE CCSA.collation_name = T.table_collation  
  AND T.table_name = "products";
WHERE table_name = "products"
  AND column_name = "name";

Also if I copy the text from the text file directly, or the error output from laravel I can insert it with MySQL workbench

insert into `products` 
(`datasource_id`, `item_group_id`, `name`, `item_group_number`, `updated_at`, `created_at`) 
values (313, '7992F', 'Cluse La Boh?â?¿me Grey Leather 38mm', '7992F', '2020-08-26 11:22:48', '2020-08-26 11:22:48');

insert into `products` 
(`datasource_id`, `item_group_id`, `name`, `item_group_number`, `updated_at`, `created_at`) 
values (313, '7992F', 'Cluse La Boh?⿿me Grey Leather 38mm', '7992F', '2020-08-26 11:22:48', '2020-08-26 11:22:48')

But if I try with Product::updateOrCreate I get an error from mysql.

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE2?\xBFme ...' for column 'name' at row 1 (SQL: insert into `products` (`datasource_id`, `item_group_id`, `name`, `item_group_number`, `updated_at`, `created_at`) values (313, 7992F, Cluse La Boh?â?¿me Grey Leather 38mm, 7992F, 2020-08-26 11:22:48, 2020-08-26 11:22:48))

The database.php config is such:

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', ''),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],

I'm opening the file with $file = fopen(Storage::path("imports/{$this->import->datasource->id}/feed.txt"), 'r');

and just looping with while (($data = fgetcsv($file, 0, "\t")) !== false) {

PHP 7.4 with mbstring

I notice when I dump the data there is a b in front of the string "name" => b"Cluse La Boh?â?¿me Grey Leather 38mm"

Any ideas on what else I can try?

1 month ago
Activity icon

Started a new Conversation Dynamic Log File Location Possible?

We have a dynamic system of data imports such that I don't want a single log file for every import we perform. Rather I'd want something like storage_path('logs/imports/{$import->id}.log where each daily import is written to it's own log

Is there a "laravel" way of doing this or better to just stick to a custom monolog implementation?

2 months ago
Activity icon

Replied to Best Way To Store A Schedule Format?

I guess I'm just asking if cron string is the best way to store something as flexible as cron.

fancy form -> condense into cron string -> database varchar -> parse cron string -> populate fancy form

Activity icon

Started a new Conversation Best Way To Store A Schedule Format?

What's a good way to store a user editable field (or fields) for them to manage when jobs run such as daily at 12, or every 4 hours, etc

Make whatever fields I need to for it to be user friendly then just store as cron format in database to be later parsed with something like perhaps?

4 months ago
Activity icon

Started a new Conversation Favorite 3rd Party Paid/free Services To Use With Laravel

What are your favorite paid (or free tier) services you use with Laravel that save you time and/or headaches?

Such as AWS S3, Mailtrap,, NewRelic/Datadog, etc. The stuff outside of the official Laravel ecosystem.

4 months ago
Activity icon

Started a new Conversation Multi-tenant SaaS And Email Domains - What Services Do You Guys Like?

Hopefully this kind of question is allowed here...

I'm curious how you guys may be handling a multi-tenant app where each customer has their own domain and their own transactional (signup/welcome/reset password/etc) and subscription based emails (blogs or notifications on topics) such that an end user has no idea they are actually using my app, they are just using my client's app -> my direct customers (transactional + subscriptions),, -> their own users (transactional + subscriptions)

Leaning towards Amazon SES

5 months ago
Activity icon

Replied to Possible To Fill Related Models With A Single Query?

I do not have a oneToMany. Also I think when using oneToMany you would be required to use 1 query per each model in the with as you will potentially get many rows and a join would not make sense anyways, so n queries is acceptable.

It's the belongsTo relationship that have n queries for n lookups is what I want to avoid

5 months ago
Activity icon

Replied to Possible To Fill Related Models With A Single Query?

so for the case where there are many lookups, and I don't really need the model most of the time to just display the label value it sounds like the only option is not to use laravel relationships and stick with a join adding a ->select(['widgets.*', ' as lookup1_name', ' as lookup2_name', etc])

which lets me do {{ $widget->lookup1_name }}

Activity icon

Started a new Conversation Possible To Fill Related Models With A Single Query?

Say you have models Widget, Lookup1, Lookup2. Lookup1 & Lookup2 are lookup tables where Widget belongsTo Lookup1 and belongsTo Lookup2.

If I just Widget::find(1) and in the template I call $widget->lookup1 and $widget->lookup2 I will end up with 3 queries.

If I try to Widget::find(1)->with(['Lookup1','Lookup2']) I also end up with 3 queries.

If I try ->join('table','first','=','second') they query works correctly but the models aren't populated and again I end up with 3 queries

Is there a way to perform a join of all the lookups and have the models be populated?

5 months ago
Activity icon

Replied to Best Way To Repeatedly Dev/test Jobs?

Well nm, I should have just exited instead of throw

  1. fill out form and upload pdf
  2. php artisan queue:work --once (exit before the end)
  3. run above as many times as needed
Activity icon

Replied to Best Way To Repeatedly Dev/test Jobs?

I said I am processing it in different ways, so yes it is more than moving the pdf

Would it be better to make a new console command and then just have the job call the command?

Activity icon

Started a new Conversation Best Way To Repeatedly Dev/test Jobs?

I have a job that a user must fill out a form and upload a file with. Based on the form settings the file can be processed in different ways.

Currently I am doing

  1. fill out form and upload pdf
  2. php artisan queue:work --once (the job has a throw at the end to send it to failed jobs)
  3. php artisan queue:failed
  4. php artisan queue:retry #ID (or just knowing to increment the ID and skip 3 for subsequent retries)
  5. go back to 2 until I've done iterating on the job

Is there a better way to go about doing this?