dev-master
9999999-dev https://github.com/lichris/blitz:description
MIT
The Requires
The Development Requires
by Heeseung Lee
laravel blitz
:description
![Total Downloads][ico-downloads]
, (*1)
This is where your description should go. Take a look at contributing.md to see a to do list., (*2)
Via Composer, (*3)
``` bash $ composer require lichris/blitz, (*4)
## Usage ### λͺ¨λΈ (DB μμ λ°μμ¨ λ μ½λλ₯Ό κ΄λ¦¬) ```php <?php namespace Api\V1\Models; use Lichris\Blitz\Models\Model; class User extends Model { // λͺ¨λΈ __construct(dbRecord) μ μ‘΄μ¬νμ§ μλ // μ΄ (column) μ μλμ μΌλ‘ μ μΈν©λλ€ // μ) new User(['asdf' => 1, 'id' => 1]) -> User(['id' => 1]) protected $filter = [ 'id', 'uuid', 'email', 'password', 'name', 'nickname', 'phone_number', ]; // toArray() __toString() toJson() μ μΆλ ₯λμ§ μμμΌν νλλ€ protected $hidden = [ 'id', 'email', 'password', ]; // κ΄κ³ λͺ¨λΈ // __construct() μ $filter μ array_merge λμ΄ μ½μ protected $relations = [ 'alert_disable', ]; }
<?php namespace Api\V1\Blitz; use Api\V1\Models\User; use Lichris\Blitz\Blitz; /** * Class UserRepository. */ class UserBlitz extends Blitz { protected $modelClass = User::class; protected $table = 'users'; protected $name = 'μ¬μ©μ'; protected $single = 'user'; protected $softDelete = true; protected $relations = [ 'alert_disable', ]; public function alertDisable() { // Query Builder κ° μ§μνλ ν¨μ 체μ΄λ ν΄μ μ¬μ© κ°λ₯ν©λλ€ return $this->hasOne(AlertDisableRepository::class, 'alert_disables', 'user_id') ->orderBy('id', 'desc'); } }
<?php namespace Api\V1\Controllers; use Api\V1\Blitz\UserBlitz; class UserController extends BaseController { public function test() { $uBlitz = new UserBlitz(); return view('test', [ 'dump' => [ $uBlitz->whereIn('id', [1, 2, 3, 4])->first(), $uBlitz->whereIn('id', [1, 2, 3, 4])->get(), $uBlitz->find(1), $uBlitz->find(1)->with(null), ], ]); } }
Please see the changelog for more information on what has changed recently., (*5)
Testing is not yet supported (in progress), (*6)
Please see contributing.md for details and a todolist., (*7)
If you discover any security related issues, please email 1541.hsl@gmail.com instead of using the issue tracker., (*8)
MIT. Please see the license file for more information., (*9)
:description
MIT
laravel blitz