Skip to content

Instantly share code, notes, and snippets.

View bobbybouwmann's full-sized avatar
🚀

Bobby Bouwmann bobbybouwmann

🚀
View GitHub Profile
@bobbybouwmann
bobbybouwmann / Example1.php
Created March 8, 2022 07:39
Exceptions for Christoph
class ChangeEmailController extends Controller
{
public function index(Request $request)
{
try {
$this->commandBus->handle(new ChangeEmailCommand($subscriptionId, $request->input('email'));
} catch (UnableToSendEmailChangeRequestException $exception) {
<?php
final class CardActivationReminder extends Notification implements MailNotificationInterface
{
use Queueable;
/**
* @var User
*/
private $user;
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

Install Laravel

First steps, setup your project!

Composer

composer create-project --prefer-dist laravel/laravel <project-name>
[
{
"id": "8983891803",
"type": "DeleteEvent",
"actor": {
"id": 5872362,
"login": "bobbybouwmann",
"display_login": "bobbybouwmann",
"gravatar_id": "",
"url": "https://api.github.com/users/bobbybouwmann",
@bobbybouwmann
bobbybouwmann / User.php
Last active April 11, 2024 12:23
Laravel Absolute vs Relative Dates with Carbon
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
@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
{

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:

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

@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 = [];