Package Data | |
---|---|
Maintainer Username: | mikebronner |
Maintainer Contact: | hello@genealabs.com (GeneaLabs, LLC) |
Package Create Date: | 2018-01-29 |
Package Last Update: | 2024-06-18 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-10-26 15:00:03 |
Package Statistics | |
---|---|
Total Downloads: | 114,920 |
Monthly Downloads: | 9,786 |
Daily Downloads: | 181 |
Total Stars: | 42 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 1 |
Methods should always return only one data-type. This principle is broken if a
method returns both null
and some other data-type, so the solution is to
return a null-class. The NullCarbon
class is a null-class implementation of
Laravel's Carbon class.
composer require genealabs/laravel-null-carbon
The following is an example of how to use the NullCarbon
class for date fields
on a model:
use GeneaLabs\LaravelNullCarbon\NullCarbon;
use Illuminate\Support\Carbon;
class MyModel
{
protected $dates = [
'published_at',
];
public function getPublishedAtAttribute() : Carbon
{
return $this->published_at
?: new NullCarbon;
}
}
During package development I try as best as possible to embrace good design and development practices to try to ensure that this package is as good as it can be. My checklist for package development includes:
Please observe and respect all aspects of the included Code of Conduct https://github.com/GeneaLabs/laravel-caffeine/blob/master/CODE_OF_CONDUCT.md.
When reporting issues, please fill out the included template as completely as possible. Incomplete issues may be ignored or closed if there is not enough information included to be actionable.
Please review the Contribution Guidelines https://github.com/GeneaLabs/laravel-caffeine/blob/master/CONTRIBUTING.md. Only PRs that meet all criterium will be accepted.
We have included the awesome symfony/thanks
composer package as a dev
dependency. Let your OS package maintainers know you appreciate them by starring
the packages you use. Simply run composer thanks
after installing this
package. (And not to worry, since it's a dev-dependency it won't be installed in
your live environment.)