PHP code example of thebachtiarz / laravel-additional-attribute-v1

1. Go to this page and download the library: Download thebachtiarz/laravel-additional-attribute-v1 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thebachtiarz / laravel-additional-attribute-v1 example snippets

 bash
php artisan vendor:publish --provider="TheBachtiarz\AdditionalAttribute\ServiceProvider"
 bash
php artisan migrate
 bash
/**
 * Create or update attribute
 *
 * @param string $attrName
 * @param mixed $attrValue
 * @return AdditionalAttribute|null
 */
public function setAttr(string $attrName, $attrValue): ?AdditionalAttribute;
 bash
/**
 * Get all attribute belongs to model
 *
 * @param boolean $map default: false
 * @return array|null
 */
public function getAttrs(bool $map = false): ?array;
 bash
/**
 * Search value by attribute name
 *
 * @param string $attrName
 * @param string $valueToSearch
 * @param boolean $map
 * @return array
 */
public static function searchValueByAttr(string $attrName, string $valueToSearch, bool $map = false): array;