sw-fw-less
  • sw-fw-less
  • get started
    • Installation
    • Directory
    • Config
    • Quick Start
  • MVC
    • Router
    • Middleware
    • Request
    • Param Validator
    • Model
    • Response
  • Database
    • MySQL
    • Redis
    • Elasticsearch
  • Storage
    • General
    • File
    • Qiniu
    • Alioss
  • OTHER
    • Pagination
    • Helper
    • Error Handler
    • AMQP-0-9-1
    • Events
  • Deployment
    • Nginx
    • Docker
  • APPENDIX
    • Development Rules
Powered by GitBook
On this page
  • MySQL Example
  • Elasticsearch Example
  • General Example

Was this helpful?

  1. MVC

Model

MySQL Example

<?php

namespace App\models;

class Member extends AbstractMysqlModel
{
    protected static $table = 'member';
}

Elasticsearch Example

<?php

namespace App\models;

class Test extends AbstractEsModel
{
    protected static $index = 'test';
    protected static $type = 'test';
}
G

General Example

// Fetch property value from model object like fetching item from an array
echo $model['foo'];

// Json Encode Model Object
echo \App\components\Helper::jsonEncode($model);
PreviousParam ValidatorNextResponse

Last updated 6 years ago

Was this helpful?