PHP code example of 404_k / k_laravel_creator

1. Go to this page and download the library: Download 404_k/k_laravel_creator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

404_k / k_laravel_creator example snippets


//in app/Entities/Creator_User_Entity.php
use K_Laravel_Creator\Entities\Base_Entity;

<php?

class Creator_User_Entity extends Base_Entity{

    public static $entity = [
        "User" => "用户"
    ];
    
    // if has on to many entity 
    public static $has_many = ['Creator_Activity'];

    /**
     * set_attribute 参数
     */
    public static function get_attribute(){
        $attribute = array();
        //wechat_id 为属性名 微信ID为字段说明 string 为该字段的类型, 可选类型有 "id" , "string" , "date_time" "url","int"
        $attribute['wechat_id'] = parent::set_attribute("微信ID","string");
        $attribute['login_sum'] = parent::set_attribute("登陆次数","int");
        $attribute['visit_password'] = parent::set_attribute("访问密码","string");
        $attribute['sina_uid'] = parent::set_attribute("新浪id","string");
        $attribute['sina_access_token'] = parent::set_attribute("新浪密钥","string");
        return array_merge(parent::get_attribute(),$attribute);
    }
}




return [
    'entities' => [
        'Creator_User'
    ]
];