Skip to content

Instantly share code, notes, and snippets.

View bobbybouwmann's full-sized avatar
🚀

Bobby Bouwmann bobbybouwmann

🚀
View GitHub Profile
Hallo!
@bobbybouwmann
bobbybouwmann / CustomValidation.php
Last active March 12, 2023 14:50
Laravel Custom Validation
<?php namespace App\Services\Validation;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Validator;
class CustomValidation extends Validator {
public function validateSumValues($attribute, $value, $parameters)
{
$sum = 0;
@bobbybouwmann
bobbybouwmann / Invoice.php
Last active January 11, 2016 16:24
Relations for invoices
<?php
namespace App;
class Invoice extends Model
{
protected $table = 'invoices';
// Don't forget to add your fillables
protected $fillable = [];

So I’m building a system that connects to multiple HR-applications. So I was thinking about using the Builder (Manager) pattern, like socialite is doing. So you can say this user is using HR-application AFAS so I new up a AFASProvider and do all my calls in there. And then I simply need to create a provider for each HR-application we support and I give them the same interface and make sure they all return the same information structure so I can work with that.

However the hard part here is that some HR-applications don’t support some functionalities that others do. So we were thinking about creating our own provider which can be used as well. So for example retrieve documents for a user is supported by AFAS but not by VISMA. So if the user is using the VISMA provider we need to make sure that for documents it’s using the local provider. Now that might not be

Keybase proof

I hereby claim:

  • I am bobbybouwmann on github.
  • I am bobbybouwmann (https://keybase.io/bobbybouwmann) on keybase.
  • I have a public key whose fingerprint is 2B92 626A 868B C5FB CDBA F645 8CB4 41E4 EE03 9C59

To claim this, I am signing this object:

@bobbybouwmann
bobbybouwmann / Dateable.php
Last active December 10, 2019 13:43
Datable trait for Laravel to convert Carbon to Jessenger\Date
<?php
namespace App\Traits;
use Carbon\Carbon;
use DateTimeInterface;
use Jenssegers\Date\Date;
trait Dateable
{
@bobbybouwmann
bobbybouwmann / User.php
Last active May 18, 2024 16:05
Laravel Absolute vs Relative Dates with Carbon
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
[
{
"id": "8983891803",
"type": "DeleteEvent",
"actor": {
"id": 5872362,
"login": "bobbybouwmann",
"display_login": "bobbybouwmann",
"gravatar_id": "",
"url": "https://api.github.com/users/bobbybouwmann",

Install Laravel

First steps, setup your project!

Composer

composer create-project --prefer-dist laravel/laravel <project-name>
composer create-project --prefer-dist laravel/laravel laravel
Installing laravel/laravel (v6.0.0)
- Installing laravel/laravel (v6.0.0): Downloading (100%)
Created project in laravel
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 80 installs, 0 updates, 0 removals
- Installing symfony/polyfill-ctype (v1.12.0): Loading from cache
- Installing phpoption/phpoption (1.5.0): Loading from cache