Skip to content

Commit

Permalink
Doc improved according to enum v2.1.0; badge love; v1.1-dev started
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Oct 16, 2017
1 parent 1476d4e commit 0fb9d7c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
###### 2017-10-06

- Initial release for Enum 2.0+, Eloquent 5.0 - 5.5
- Works likes Eloquent's `$cast` property on models, but internally hooks into the mutator/accessor mechanism
- Works like Eloquent's `$cast` property on models, but internally hooks into the mutator/accessor mechanism
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Konekt Enum Eloquent Bindings


[![Build Status](https://travis-ci.org/artkonekt/enum-eloquent.png?branch=master)](https://travis-ci.org/artkonekt/enum-eloquent)
[![Latest Stable Version](https://poser.pugx.org/konekt/enum-eloquent/version.png)](https://packagist.org/packages/konekt/enum-eloquent)
[![Total Downloads](https://poser.pugx.org/konekt/enum-eloquent/downloads.png)](https://packagist.org/packages/konekt/enum-eloquent)
[![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)
[![Travis Build Status](https://img.shields.io/travis/artkonekt/enum-eloquent.svg?style=flat-square)](https://travis-ci.org/artkonekt/enum-eloquent)
[![Packagist Stable Version](https://img.shields.io/packagist/v/konekt/enum-eloquent.svg?style=flat-square&label=stable)](https://packagist.org/packages/konekt/enum-eloquent)
[![Packagist downloads](https://img.shields.io/packagist/dt/konekt/enum-eloquent.svg?style=flat-square)](https://packagist.org/packages/konekt/enum-eloquent)
[![MIT Software License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.md)

This package provides support for auto casting [konekt enum](https://github.com/artkonekt/enum) fields in [Eloquent models](https://laravel.com/docs/5.4/eloquent-mutators).

Expand Down Expand Up @@ -72,10 +72,10 @@ echo get_class($order->status);
echo $order->status->value();
// output: 'pending'

echo $order->status->equals(OrderStatus::PENDING()) ? 'yes' : 'no';
echo $order->status->isPending() ? 'yes' : 'no';
// output: yes

echo $order->status->equals(OrderStatus::CANCELLED()) ? 'yes' : 'no';
echo $order->status->isCancelled() ? 'yes' : 'no';
// output: no

// You can assign an enum object as attribute value:
Expand All @@ -93,7 +93,7 @@ echo $order->status->value();

// It still accepts scalar values:
$order->status = 'completed';
echo $order->status->equals(OrderStatus::COMPLETED()) ? 'yes' : 'no';
echo $order->status->isCompleted() ? 'yes' : 'no';
// output: yes

// But it doesn't accept scalar values that aren't in the enum:
Expand All @@ -104,4 +104,4 @@ $order->status = 'negotiating';

Enjoy!

For detailed usage of konekt enums refer to [its readme](https://github.com/artkonekt/enum).
For detailed usage of konekt enums refer to the [Konekt Enum Documentation](https://artkonekt.github.io/enum).
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
"psr-4": {
"Konekt\\Enum\\Eloquent\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
}
}

0 comments on commit 0fb9d7c

Please sign in to comment.