Looking to hire Laravel developers? Try LaraJobs

laravel-morph-alias-attribute maintained by gpanos

Description
Register morph aliases for your laravel models using php 8 attributes
Last update
2021/10/08 16:41 (dev-master)
License
Downloads
0
Tags

Comments
comments powered by Disqus

PHP 8 attribute to register Laravel custom polymorphic types.

tests code style

Instead of defining custom polymorphic types inside service providers this package offers an alternative way using php 8 attributes.

Inspired by spatie/laravel-route-attributes

Installation

composer require gpanos/laravel-morph-alias-attribute

Usage

To define a morph alias for your model add the MorphAlias attribute and pass it your alias.

<?php

#[MorphAlias('post')]
class Post extends Model
{
    ...
}