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.
@peterbrinck
peterbrinck / cookier_banner.html
Created April 3, 2020 06:55
Simple cookie-banner with AlpineJS - original by @lepikhinb
<div x-data="{ show: !localStorage.getItem('hide-banner')}">
<div x-show="show">
<button type="button" @click="localStorage.setItem('hide-banner', true); show = false;">
OK!
</button>
</div>
</div>
@peterbrinck
peterbrinck / keybase.md
Created September 10, 2019 16:52
keybase.md

Keybase proof

I hereby claim:

  • I am peterbrinck on github.
  • I am peterbrinck (https://keybase.io/peterbrinck) on keybase.
  • I have a public key ASCC8XKltzHrq9LokDv_-Z-kv0pL164RJ5upUaDPERwOaQo

To claim this, I am signing this object:

linear-gradient(to right, #ff4747 0%,#ffe349 16%,#49ff7a 41%,#49b9ff 59%,#49b9ff 59%,#494fff 73%,#f549ff 87%,#ff474a 100%)
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@peterbrinck
peterbrinck / Laravel on VestaCP.md
Last active July 2, 2023 14:49
Laravel web templates for VestaCP

I'm not using this or VestaCP anymore, so I can't confirm if still working or not.

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html

@peterbrinck
peterbrinck / RESTART GNOME WITHOUT RESTART.md
Created June 18, 2017 09:58
How to restart GNOME Shell without restart

Restart GNOME Shell without restart

The easiest way is to ALT + F2 and then run this command: gnome-shell -r (--replace)