pharous-backend / laravel-eloquent-urls
Laravel - Model's Multi URLs
1.0.0
2021-01-31 12:32 UTC
Requires
- php: >=7.2
- laravel/framework: >=6.0
- pharaonic/laravel-helpers: >=1.0
This package is not auto-updated.
Last update: 2025-03-25 07:50:04 UTC
README
Laravel - Model's Multi URLs.
Install
Install the latest version using Composer:
$ composer require pharous-backend/laravel-eloquent-urls
$ php artisan vendor:publish --tag=laravel-eloquent-urls $ php artisan migrate
Usage
Including it in a Model
// An example // Using HasURLs in User Model ... use Pharous\Laravel\Eloquent\URL\HasURLs; class User extends Model { use HasURLs; /** * URLs Attributes * * @var array */ protected $URLsAttributes = ['facebook']; ... }
How to use
$user = User::find(1); // Model $user->facebook = 'https://www.facebook.com/MoamenEltouny'; // Set Facebook URL $user->facebook->click(); // Increment clicks count echo $user->facebook->clicks; // Display clicks count echo $user->facebook->url; // Display Facebook URL