{"id":15293890,"url":"https://github.com/quansitech/lara-for-tp","last_synced_at":"2025-10-08T02:29:12.933Z","repository":{"id":57069520,"uuid":"179055125","full_name":"quansitech/lara-for-tp","owner":"quansitech","description":"把laravel当作开发工具集成进tp，以实现数据库管理及自动化测试","archived":false,"fork":false,"pushed_at":"2020-01-19T07:51:53.000Z","size":257,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T21:13:12.732Z","etag":null,"topics":["laravel-framework","thinkphp"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quansitech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.996ICU","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-02T10:35:06.000Z","updated_at":"2020-01-19T07:50:53.000Z","dependencies_parsed_at":"2022-08-24T14:54:17.537Z","dependency_job_id":null,"html_url":"https://github.com/quansitech/lara-for-tp","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/quansitech/lara-for-tp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Flara-for-tp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Flara-for-tp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Flara-for-tp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Flara-for-tp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quansitech","download_url":"https://codeload.github.com/quansitech/lara-for-tp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quansitech%2Flara-for-tp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278877323,"owners_count":26061428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel-framework","thinkphp"],"created_at":"2024-09-30T16:53:35.689Z","updated_at":"2025-10-08T02:29:12.917Z","avatar_url":"https://github.com/quansitech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lara for Tp\n![Travis (.com)](https://img.shields.io/travis/com/tiderjian/lara-for-tp.svg?style=flat-square)\n![style ci](https://img.shields.io/travis/com/tiderjian/lara-for-tp.svg?style=flat-square)\n![download](https://img.shields.io/packagist/dt/tiderjian/lara-for-tp.svg?style=flat-square)\n![lincense](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)\n[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n![Pull request welcome](https://img.shields.io/badge/pr-welcome-green.svg?style=flat-square)\n\n## 介绍\n由于还有很多老旧但又重要的项目依然采用tp3.2来实现，Lara for Tp就是为了让过时的tp能使用laravel的migrate数据库版本管理及laravel dusk的功能，以实现更科学的开发部署方法。\n   \n\n## 安装\n安装[qs_cmf](https://github.com/tiderjian/qs_cmf)\n\ncomposer安装\n```\ncomposer require tiderjian/lara-for-tp\n```\n\n安装后执行vendor/bin/larafortp 脚本，完成自动安装。\n\n\n## 使用\n目前支持的laravel功能有 migrate、make:model、make:seeder、db:seed，具体用法请自行查阅laravel手册。\n\nmigrate文件必须存放在lara/database/migrations下,在lara目录下的.env文件中配置要访问的数据库,然后在项目根目录执行php artisan migrate即可完成数据库的迁移，相关的migrate命令可查看[laravel文档](https://learnku.com/docs/laravel/5.8/migrations/3928)。\n\n测试脚本必须存放到lara/tests路径下，继承该目录下的TestCase类。配置phpunit.xml文件，设置可用于测试使用的数据库及web服务地址端口。最后运行phpunit，执行测试脚本。关于laravel dusk的使用请查阅[laravel文档](https://learnku.com/docs/laravel/5.8/dusk/3943)。\n\n## 文档\n### MenuGenerate\n用于生成后台的菜单选项\n#### 案例一\n```\n\u003c?php\n\nuse Illuminate\\Support\\Facades\\Schema;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Larafortp\\MenuGenerate;\n\nclass CreateSeed extends Migration\n{\n    private $menuData = array(\n        array(\n            'title'=\u003e'平台2',//标题              (必填)\n            'module'=\u003e'admin1',//模块英文名        (必填)\n            'module_name'=\u003e'后台管理',//模块中文名   (必填)\n            'url'=\u003e'',//url                  (必填)\n            'type'=\u003e'',//类型                (选填）\n            'sort'=\u003e0,//排序                (选填）\n            'icon'=\u003e'',//icon                (选填）\n            'status'=\u003e1,//状态              (选填）\n            'top_menu' =\u003e array(\n                '新闻中心'=\u003earray(\n                        array(\n                            'name'=\u003e'index',       //（必填）\n                            'title'=\u003e'测试新闻中心',    //（必填）'\n                            'controller'=\u003e'News',//（必填）\n                            'sort' =\u003e 1, //排序       //（选填）\n                            'icon'=\u003e '',//图标        //（选填）\n                            'remark'=\u003e '',//备注      //（选填）\n                            'status'=\u003e1,//状态        //（选填）\n                        ),\n                ),\n            ),\n        ),\n    );\n    /**\n     * Run the migrations.\n     *\n     * @return void\n     */\n    public function up()\n    {\n        $menuGenerate = new MenuGenerate();\n        $menuGenerate-\u003einsertNavigationAll($this-\u003emenuData);\n    }\n\n    /**\n     * Reverse the migrations.\n     *\n     * @return void\n     */\n    public function down()\n    {\n        $menuGenerate = new MenuGenerate();\n        $menuGenerate-\u003einsertNavigationAllRollback($this-\u003emenuData);\n    }\n}\n```\n#### 案例二\n```\n\u003c?php\n\nuse Illuminate\\Support\\Facades\\Schema;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Larafortp\\MenuGenerate;\n\nclass CreateSeed extends Migration\n{\n    private $menuData = array(\n        '测试模块'=\u003earray(\n            array(\n                'name'=\u003e'index2',\n                'title'=\u003e'首页轮播图',\n                'sort' =\u003e 0,\n                'controller'=\u003e'NewsCate',\n                'status'=\u003e1,\n            ),\n            array(\n                'name'=\u003e'index3',\n                'title'=\u003e'首页信息配置',\n                'sort' =\u003e 1,\n                'controller'=\u003e'NewsCate',\n                'status'=\u003e1,\n            ),\n            array(\n                'name'=\u003e'money4',\n                'title'=\u003e'捐款总金额',\n                'controller'=\u003e'NewsCate'\n            ),\n        ),\n    );\n    /**\n     * Run the migrations.\n     *\n     * @return void\n     */\n    public function up()\n    {\n        $menuGenerate = new MenuGenerate();\n        $menuGenerate-\u003einsertAll($this-\u003emenuData);\n    }\n\n    /**\n     * Reverse the migrations.\n     *\n     * @return void\n     */\n    public function down()\n    {\n        $menuGenerate = new MenuGenerate();\n        $menuGenerate-\u003einsertAllRollback($this-\u003emenuData);\n    }\n}\n\n```\n\n### Faker\nlaravel默认得Faker工具不支持zh_CN简体文本的生成，修复了该问题\n\nFaker的image生成使用的[lorempixel](http://lorempixel.com/)，生成某些尺寸的图片时很容易出现烂图。因此使用了[placeimg](http://placeimg.com/)替换掉该功能。\n\n## lincense\n[MIT License](https://github.com/tiderjian/lara-for-tp/blob/master/LICENSE.MIT) AND [996ICU License](https://github.com/tiderjian/lara-for-tp/blob/master/LICENSE.996ICU)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquansitech%2Flara-for-tp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquansitech%2Flara-for-tp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquansitech%2Flara-for-tp/lists"}