2017 © Pedro PelΓ‘ez
 

library blitz

:description

image

lichris/blitz

:description

  • Thursday, July 5, 2018
  • by lichris
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Blitz

Latest Version on Packagist ![Total Downloads][ico-downloads] Build Status StyleCI, (*1)

This is where your description should go. Take a look at contributing.md to see a to do list., (*2)

Installation

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', ]; }

블리츠 (DB 와 직접 톡신)

<?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),
            ],
        ]);
    }
}

Change log

Please see the changelog for more information on what has changed recently., (*5)

Testing

Testing is not yet supported (in progress), (*6)

Contributing

Please see contributing.md for details and a todolist., (*7)

Security

If you discover any security related issues, please email 1541.hsl@gmail.com instead of using the issue tracker., (*8)

Credits

License

MIT. Please see the license file for more information., (*9)

The Versions

05/07 2018

dev-master

9999999-dev https://github.com/lichris/blitz

:description

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel blitz