定制 morningtrain/wp-database 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

morningtrain/wp-database

最新稳定版本:v0.3.0

Composer 安装命令:

composer require morningtrain/wp-database

包简介

Laravel Eloquent and Migrations for WordPress

README 文档

README

A Morningtrain package that implements Laravel Eloquent and Migrations into WordPress.

Table of Contents

Introduction

Getting Started

To get started install the package as described below in Installation.

To use the tool have a look at Usage

Installation

Install with composer

composer require morningtrain/wp-database

Dependencies

illuminate/database

Database

Usage

Initializing package

<?php
    Database::setup(__DIR__ . "/database/migrations");

If you want to use migrations from multiple directories you can do, by calling the setup method multiple times.

Creating a Model

In app/Models

// Foo.php
<?php

    namespace MyProject\App\Models;

    /**
     * @property int $id
     * @property string $title
     */
    class Foo extends \Illuminate\Database\Eloquent\Model
    {
        public $timestamps = false;
        protected $table = 'foo';
    }

Creating a Migration

wp make:migration create_foo_table

If there is multiple migration paths, you will be asked to choose one.
Will create a new migration file for you with Schema::create('foo') already prepared.

Running migrations

You can run all new migrations like so:

Using wp cli:

wp dbmigrate

Using php:

<?php
    \Morningtrain\WP\Database\Database::migrate();
?>

Credits

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 773
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固