Package Data | |
---|---|
Maintainer Username: | n7olkachev |
Maintainer Contact: | n7olkachev@gmail.com (Nikita Tolkachev) |
Package Create Date: | 2017-08-28 |
Package Last Update: | 2017-08-28 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-21 03:00:46 |
Package Statistics | |
---|---|
Total Downloads: | 651 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 11 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package gives you ability to use getFooBarAttribute
and setFooBarAttribute
methods in your classes with one trait.
class User
{
use Accessors;
protected $name;
public function __construct($name)
{
$this->name = $name;
}
public function getNameAttribute()
{
return $this->name;
}
public function setNameAttribute($name)
{
$this->name = $name;
}
}
$user = new User('Nick');
echo $user->name; // calls getNameAttribute
$user->name = 'Not Nick' // calls setNameAttribute
$ composer require n7olkachev/laravel-accessors
In your class:
class User
{
use Accessors;
}
$ composer test
https://websecret.by/
Web agency based in Minsk, Belarus
The MIT License (MIT)