2017 © Pedro Peláez
 

library model

An Laravel eloquent-like model class, for Laravel and other frameworks

image

jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  • Saturday, July 21, 2018
  • by jenssegers
  • Repository
  • 10 Watchers
  • 137 Stars
  • 164,666 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 14 Forks
  • 10 Open issues
  • 10 Versions
  • 17 % Grown

The README.md

Model

Build Status Coverage Status, (*1)

This model provides an Laravel eloquent-like base class that can be used to build custom models in Laravel or other frameworks., (*2)

Features

  • Accessors and mutators
  • Model to Array and JSON conversion
  • Hidden attributes in Array/JSON conversion
  • Guarded and fillable attributes
  • Appending accessors and mutators to Array/JSON conversion
  • Attribute casting

You can read more about these features and the original Eloquent model on http://laravel.com/docs/eloquent, (*3)

Installation

Install using composer:, (*4)

composer require jenssegers/model

Example


use Jenssegers\Model\Model; class User extends Model { protected $hidden = ['password']; protected $guarded = ['password']; protected $casts = ['age' => 'integer']; public function save() { return API::post('/items', $this->attributes); } public function setBirthdayAttribute($value) { $this->attributes['birthday'] = strtotime($value); } public function getBirthdayAttribute($value) { return new DateTime("@$value"); } public function getAgeAttribute($value) { return $this->birthday->diff(new DateTime('now'))->y; } } $item = new User(array('name' => 'john')); $item->password = 'bar'; echo $item; // {"name":"john"}

The Versions

21/07 2018

dev-master

9999999-dev https://github.com/jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

21/07 2018

v1.2.0

1.2.0.0 https://github.com/jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

21/02 2017

v1.1.2

1.1.2.0 https://github.com/jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

21/02 2017

dev-analysis-qxJpr0

dev-analysis-qxJpr0 https://github.com/jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

28/12 2015

v1.1.1

1.1.1.0 https://github.com/jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

11/12 2015

v1.1.0

1.1.0.0 https://github.com/jenssegers/laravel-model

An eloquent-like model, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

14/05 2015

v1.0.3

1.0.3.0

An eloquent-like model, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

03/01 2015

v1.0.2

1.0.2.0

An eloquent-like model, for Laravel and other frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent model

27/04 2014

v1.0.1

1.0.1.0

An eloquent-like model, for Laravel 4 and other frameworks

  Sources   Download

MIT

The Requires

 

laravel eloquent model

13/01 2014

v1.0.0

1.0.0.0

An eloquent-like model, for Laravel 4 and other frameworks

  Sources   Download

MIT

The Requires

 

laravel eloquent model