vkronlein

vkronlein

Owner / Lead Developer at Periapt, LLC.

Member Since 5 Years Ago

Queen Creek, AZ

Experience Points
47,190
Total
Experience

2,810 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
494
Lessons
Completed
Best Reply Awards
1
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 10
47,190 XP
Oct
02
2 weeks ago
Activity icon

Replied to Envoyer Type Deployment On Forge

Ok here we go.

This works really well on all the sites I implemented it on.

Hopefully it will help you out if you're in a situation where you can't use Envoyer for some reason.

# delete our old deploy directory if it exists
if [ -d "/home/forge/deploy" ] 
then 
	rm -rf /home/forge/deploy
fi

# create a deploy directory
mkdir /home/forge/deploy

# move into the directory
cd /home/forge/deploy

# clone your repository branch 
git clone -b $FORGE_SITE_BRANCH [email protected]:Example/example.git .

# copy needed files that aren't committed to git
cp /home/forge/example.com/.env /home/forge/deploy/.env
cp -r /home/forge/example.com/storage /home/forge/deploy

# install dependencies with composer
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader

# restart PHP-FPM
( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

# run artisan and node commands
php artisan migrate --force
npm install
npm run production
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan queue:restart

# now that scripts are compiled remove the node directory
rm -rf node_modules

# delete our old backup directory
if [ -d "/home/forge/backup" ] 
then 
	rm -rf /home/forge/backup
fi

# backup the current build
mv /home/forge/example /home/forge/backup

# deploy the new build
mv /home/forge/deploy /home/forge/example.com

# move into new build directory
cd /home/forge/example.com

# link your storage directory
php artisan storage:link

Cheers.

Activity icon

Started a new Conversation Envoyer Type Deployment On Forge

Despite my best efforts I cannot get my client to spring for Envoyer, so I'm setting out to build a similar workflow just using the Forge deployment script.

This seemed like an easy task, but apparently I don't have the needed git commands to make this work.

My initial attempt looks like so:

# make a deploy dir
mkdir /home/forge/deploying

# copy existing .git directory to deploy
cp -r /home/forge/example.com/.git /home/forge/deploying/.git

# cd into deploying
cd /home/forge/deploying

# fetch and pull
git fetch --all
git pull origin develop

# typical forge commands
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader
( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

php artisan migrate --force
npm install
npm run dev
php artisan config:clear
php artisan cache:clear
php artisan queue:restart

# since npm has compiled theres no need to keep all these files
rm -rf node_modules

# delete the old site
rm -rf /home/forge/example.com

# change the name of the deploying dir
mv /home/forge/deploying /home/forge/example.com

I know that Envoyer is more elegant with this, providing several backups and other features and I may try that once I get something basic to work.

Right now it dies at composer install because it's not pulling in all the files, only any changed files.

Any help?

Sep
28
3 weeks ago
Activity icon

Started a new Conversation Handling Fonts In Vapor

I just started checking out vapor and after MUCH trial and error on getting my Inertia app going, I finally have it running as normal.

Only one major issue left and that's handling vendor installed fonts.

I can see that my webpack generated public/font directory does get uploaded to cloudfront, but nothing but 404's for all my vendor fonts.

I have the asset_url in my meta tag that helps fix the Vue images, is there some way to fix my fonts using this, or is there another approach I can use?

Activity icon

Replied to Homestead Without Apache

@automica

Thanks for the reply. This is what I normally do, I just figured there was a Homestead.yml flag I could throw.

Appreciate it.

Sep
26
3 weeks ago
Activity icon

Started a new Conversation Homestead Without Apache

There isn't a channel for Homestead so I just figured this might be the place.

Looking at the docs, it mentions that Apache is optional, but it doesn't list whether to disable it as a service, or set it to false as a feature so that it isn't installed.

I don't want apache anywhere near my dev environment, so I'd rather it not be on my server at all, instead of having to remove it manually through the terminal.

Thanks.

Sep
22
4 weeks ago
Activity icon

Awarded Best Reply on Collection Filter By Array

Ok so here's a version with the map method.

$score = $items->map(function($item) use($hazards) {
    return $hazards[$item->field];
})->max();

$ha = array_flip($hazards);

$worst = $ha[$score];

Not exactly elegant but it always returns the correct item from the collection.

Thanks @jlrdw for trying to help out, much appreciated.

Activity icon

Replied to Collection Filter By Array

@jlrdw

Yeah you still aren't addressing the models at all. I don't need the max value in the array, I need the item from the collection that has the highest value in the array.

Goodness.

Sep
21
4 weeks ago
Activity icon

Replied to Collection Filter By Array

Ok so here's a version with the map method.

$score = $items->map(function($item) use($hazards) {
    return $hazards[$item->field];
})->max();

$ha = array_flip($hazards);

$worst = $ha[$score];

Not exactly elegant but it always returns the correct item from the collection.

Thanks @jlrdw for trying to help out, much appreciated.

Activity icon

Replied to Collection Filter By Array

@jlrdw

First of all, hazards isn't a collection so that that would fail.

Second, how does that return the $item model with the highest score?

Even if I did

$worst = collect($hazards)->max();

That would be of zero help finding the model with the highest score.

???

Activity icon

Replied to Collection Filter By Array

@jlrdw

I already looked through all the methods.

I'm calling max on the returned collection.

Activity icon

Started a new Conversation Collection Filter By Array

I have an array of Greenscreen List Translator scores from worst to best like so:

$hazards = [
    'BM-1'   => 8,
    'LT-1'   => 7,
    'LT-P1'  => 6,
    'LT-UNK' => 5,
    'BM-2'   => 4,
    'BM-3'   => 3,
    'BM-4'   => 2,
    'BM-U'   => 1,
    'NoGS'   => 0,
    'Not Screened' => 0,
];

I have a collection of models and I need to filter the collection down to the model with the highest score.

I have this and it does return a model, but it's not consistently the correct one.

$worst = $items->filter(function($item) use($hazards) {
    return $hazards[$item->field];
})->max();

Maybe I'm reaching for the wrong collection method?

Thanks

Sep
13
1 month ago
Activity icon

Replied to How To Flash Messages In Same Page Without Redirecting?

@snapey

Flashing a message without redirecting is not an Inertia issue. It's a Laravel issue. I only wrote that I was using Inertia as an aside in hopes it might lead to a faster resolution. Though using Inertia did lead to a much faster and simpler answer.

But thank you for hopping in here and helping with the issue.

.... oh wait ....

Activity icon

Replied to How To Flash Messages In Same Page Without Redirecting?

@snapey

How is it not related? I'm having this exact problem, I need to flash on an existing page.

This question has no answer yet ... no reason to open a new one, I searched and found this open one.

Sorry if this isn't the proper way, I'm used to SO where you get hammered for not searching to find the answers before you open a new question.

Activity icon

Started a new Conversation Passport And Inertia

I've been tasked with converting our API written in Laravel 5.8 and MaterialCSS to The latest Laravel 8 and Inertia w TailwindCSS.

First step get a working Laravel 6 version -- has proven to be more difficult than I imagined.

We do have a user area for users to make clients and manage their authorized apps, so I have both a /signin route for these users, and because Passport seems to do some sort of magic to redirect to /login this route needs to be a non-inertia page as well as the /authorize route.

No matter what I do I'm unable to bypass Inertia. Passport redirects to the non-inertia page, but it throws mad Inertia related errors.

I'm aware of this issue https://github.com/inertiajs/inertia-laravel/issues/57 and I've even spoke to Jonathan on Twitter regarding the static macro issue for PHP 7.4, but I've not found a way to get this working.

Anyone that can assist I would be eternally grateful.

Activity icon

Replied to Clipboard Tool On Forge

@sinnbeck

Yeah I've seen this the the vue-wrapper for it, just trying to see if anyone knows specifically what that implementation is. I've seen it elsewhere too, so I was thinking it might be a node package.

Sep
11
1 month ago
Activity icon

Replied to How To Flash Messages In Same Page Without Redirecting?

@tang.chanrith

I see this in the Store class, and I'm trying to use if but it's not working.

session()->now('success', 'The client was updated successfully.');

Nothing at all. I also tried:

session()->now('success', 'The client was updated successfully.');
session()->reflash();

No love on flash at all without a redirect, I'm using Inertia so there's no redirect here.

Activity icon

Started a new Conversation Clipboard Tool On Forge

Hey All.

Does anyone know what clipboard tool is being used on Laravel Forge?

It's used in several places like on the dashboard, when you hover over a server IP address you see a small copy link to the right, and when you click it, it copies and you get a nice quick little animation that says Copied!

I assume this is a vue component or directive of some sort.

Anyone that can point me in the right direction for this? Or something very similar that can be used in Vue.

Thanks

Activity icon

Awarded Best Reply on Model Not Filling

DOH ... nevermind. I see it now.

Aug
26
1 month ago
Activity icon

Replied to Strange Date Strings In Vue With Laravel 7

@silencebringer

I knew they were cast as Carbon instances, hence my discussion of it in the question, I've just never seen them needing to recast unless you wanted to change the default format to say m/d/y or something.

I've cast them in model like so:

'created_at' => 'datetime:Y-m-d H:i:s',

Works a charm.

Thanks for the heads up.

Activity icon

Started a new Conversation Strange Date Strings In Vue With Laravel 7

I'm using Vue with Laravel 7 and Inertia and my dates are showing up like so:

created_at: "2020-05-12T03:47:41.000000Z"

If I die and dump the model before it gets to Vue they look like normal datetime strings:

"created_at" => "2020-05-11 20:47:41"

I've tried casting them as strings ... looked through all of the Inertia code ...

I first noticed this when updating Carbon, so maybe this is more of a Carbon issue than Laravel or Vue?

Any help appreciated.

Activity icon

Replied to Model Not Filling

@sinnbeck

Yep ... stupid

Aug
24
1 month ago
Activity icon

Replied to Model Not Filling

DOH ... nevermind. I see it now.

Activity icon

Started a new Conversation Model Not Filling

I'm posting from a Vue component to create a new Zone model on my app.

I'm getting the following insert error:

Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1364 Field 'country_id' doesn't have a default value (SQL: insert into `zones` (`name`, `code`, `status`, `id`, `updated_at`, `created_at`) values (Test Zone, TSZ, 1, 30592642137481216, 2020-08-24 10:04:14, 2020-08-24 10:04:14))

When I dump the request attributes just prior to calling the create method I get this:

array:4 [▼
  "company_id" => 30555102852440064
  "name" => "Test Zone"
  "code" => "TSZ"
  "status" => true
]

Clearly the company_id is being passed in. If I dump the model before saving:

App\Domain\Entities\Zone {#497 ▼
  #fillable: array:4 [▼
    0 => "country_id"
    1 => "name"
    2 => "code"
    3 => "status"
  ]
  #primaryKey: "id"
  +incrementing: false
  #perPage: 10
  #connection: null
  #table: null
  #keyType: "int"
  #with: []
  #withCount: []
  +exists: false
  +wasRecentlyCreated: false
  #attributes: array:3 [▼
    "name" => "Test Zone"
    "code" => "TSZ"
    "status" => true
  ]
  #original: []
  #changes: []
  #casts: []
  #classCastCache: []
  #dates: array:1 [▶]
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #guarded: array:1 [▶]
  #forceDeleting: false
}

Here you can see that clearly the company_id is fillable, but yet doesn't not appear in the attributes as expected.

Any ideas on what is causing this would be appreciated.