Skip to content

Instantly share code, notes, and snippets.

View lfarkas's full-sized avatar

Levente Farkas lfarkas

  • Vidux Ltd.
  • Hungary
  • 09:19 (UTC +02:00)
  • LinkedIn in/lfarkas
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lfarkas on github.
  • I am lfarkas (https://keybase.io/lfarkas) on keybase.
  • I have a public key ASCGG8x7KRgqA69OOUauxe8rfQsCNYFF3ZM5WgtKo5rzfwo

To claim this, I am signing this object:

@lfarkas
lfarkas / NullableFields.php
Created May 19, 2016 10:29
NullableFields trait for Laravel 5
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Use this trait if you some of the fields could be converted to null
* automatically if they are empty.
* In the Model class $nullable properties should have to be defined as:
@lfarkas
lfarkas / BaseModel.php
Last active December 6, 2016 09:10
Nullable value in Laravel 5 field value from HTML form. Until this bug is fixed: https://github.com/laravel/framework/issues/13613 you can overrides Model's asDateTime or use $this->attributes[$field] in stead of $this->{$field}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
/**
* Fields which have to be convert to null in case of empty imput.