{"repo":"spatie/laravel-enum","free":true,"listed":false,"github":"https://github.com/spatie/laravel-enum","clone":"git clone https://github.com/spatie/laravel-enum.git","description":"Laravel support for spatie/enum","language":"PHP","stars":365,"topics":["php","enum","laravel"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Laravel support for spatie/enum This package provides extended support for our spatie/enum package in Laravel. Installation You can install the package via composer: Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Usage Model Attribute casting Chances are that if you're working in a Laravel project, you'll want to use enums within your models. This package provides two custom casts and the \\Spatie\\Enum\\Laravel\\Enum also implements the \\Illuminate\\Contracts\\Database\\Eloquent\\Castable interface. By using the casts the casted attribute will always be an instance of the given enum. Validation Rule This package provides a validation rule to validate your request data against a given enumerable. This rule validates that the value of status is any possible representation of the StatusEnum . But you can also use the simple string validation rule definition: If you want to customize the failed validation messages you can publish the translation file. We pass several replacements to the translation key which you can use. - attribute - the name of the validated attribute - value - the actual value that's validated - enum - the full class name of the wanted enumerable - ","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/laravel-enum/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}