Download the PHP package ametsuramet/simple_orm without Composer
On this page you can find all versions of the php package ametsuramet/simple_orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ametsuramet/simple_orm
More information about ametsuramet/simple_orm
Files in ametsuramet/simple_orm
Package simple_orm
Short Description DB Wrapper for build simple orm in laravel
License MIT
Informations about the package simple_orm
Simple ORM for LARAVEL
Laravel Package alternative for Eloquent ORM.
Installation
Begin by pulling in the package through Composer.
Or add in the require
key of composer.json
file manually
Register the ServiceProvider in config/app.php
For Lumen
Add this service provider to your bootstrap/app.php
file.
Defining Models
The easiest way to create a model instance is using the simple_orm:model
Artisan command:
or you can use interactive mode:
Command Options
All models will placed in app/ORM
folder.
Usage
in your controller file:
or something like this:
Table Names
By Default SimpleORM will generate $table attribut, but you can change name of table in Models
Default Keys
SimpleORM will also assume that each table has a primary key column named id. You may define a _$defaultkey property to override.
Public Method
where((array) $params)
or
limit((int) $params, (int) $params)
you can add offset :
deleted_only()
Show deleted only
deleted((boolean) $params)
As noted above, soft deleted models will automatically be excluded from query results, you can use this method to include deleted records
info()
orderBy((string) $params, (string) $params)
or
groupBy()
or
insert((array) $params)
update($id,(array) $params)
delete($id)
get()
first()
find($id)
last()
paginate((int) $params)
set_show_column((array) $params)
hide_relation()
count()
getQueryLog()
Relation
hasOne($relation_table,$relation_key,$table_key,$relation_name,$show_column(optional))
with show_column
hasMany($relation_table,$relation_key,$table_key,$relation_name,$show_column(optional))
with show_column
manyToMany($relation_table,$relation_key,$table_key,$relation_name,$pivot_table,$show_column(optional))
with show_column