Skip to content

Instantly share code, notes, and snippets.

View peterbrinck's full-sized avatar
🤔
 

Peter Brinck peterbrinck

🤔
 
View GitHub Profile

Testing Laravel Validation

Register the macro in a service provider or use the MacroServiceProvider to keep things tidy. Be sure to register it in the array in the /bootstrap/providers.php file.

You can then use the test example to “use” a dataset to run through your validation rules.

It will execute each item in the dataset, building the request for the provided parameter and the (incorrect) value, and then assert that the error is as expected.

If the validation fails to run, the error will not be found, and the test will fail. Similarily, if the error message changes, the test will fail.

@peterbrinck
peterbrinck / moleculer-k8.md
Created December 14, 2020 08:16
Moleculer k8 depoyment

Create a cluster on GKE:

gcloud container clusters create backend --num-nodes=2 --machine-type n1-standard-4

Get credentials:

gcloud container clusters get-credentials backend

Build the docker image:

@peterbrinck
peterbrinck / EncryptedJson.php
Created October 22, 2020 11:30 — forked from Sammyjo20/EncryptedJson.php
EncryptedJson Cast
<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class EncryptedJson implements CastsAttributes
{
/**
* Cast the given value.
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//