0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CakePHP5, Bootstrap5 でサクッと開発

Posted at

すぐ忘れて毎回調べなおすのが面倒なので忘備録。サクッとしたい。このスピード感、大好き(#^^#)

環境

  • Win10, VSCode, A5M2, XAMPP
  • composer
  • Git

いざ作業

A5M2 DDLを作ってデータベース作成※ここからよく忘れるCakePHPインストール

composer self-update
composer create-project --prefer-dist cakephp/app [PROJECTNAME]

Git ここにリポジトリ作成Git コミット しておこうここからはVSCodeで。
CakePHPのデータベース設定config/app_local.phpブラウザで確認

次、Bootstrap !

composer require friendsofcake/bootstrap-ui
bin/cake plugin load BootstrapUI

bin/cake bootstrap install
bin/cake bootstrap modify_view
bin/cake bootstrap copy_layouts

で、開発スタート。まずはバンバンbakeしまくる

bin/cake bake all [TABLENAME] -t BootstrapUI
bin/cake bake all [TABLENAME] -t BootstrapUI
bin/cake bake all [TABLENAME] -t BootstrapUI
bin/cake bake all [TABLENAME] -t BootstrapUI
bin/cake bake all [TABLENAME] -t BootstrapUI
...

↓の順でもいいよ。

bin/cake bake all -t BootstrapUI [TABLENAME]

A5M2からエンティティ定義書をExcel出力して、テーブル名一覧で上記コマンドを一括作成すると、bakeコマンドコピペで一撃!

VSCodeのボックス選択は SHIFT + ALT でドラッグです

ここで、多分エラー

Cake\View\Helper\HtmlHelper::link(): Argument #1 ($title) must be of type array|string, null given, called in C:\xxxxxx[projectname]\templates\layout\TwitterBootstrap\dashboard.php on line 18📋

なぬ!

templates/layout/TwitterBootstrap/dashboard.php

<?= $this->Html->link(
            Configure::read('App.title'), // line 18

Config に App.titleが欲しいそうです。ここを消しちゃうか、残すなら config/app.php に追記。

config/app.php
'App' => [
    ...
    'title' => '[PROJECTNAME]', //追記

動作確認

ここらへんで Git コミット

仕事した感が出たので今日はこの辺で。まだ数分ですが…(笑)

あれ?Bootstrapの動きが??...と思ったらはい、そうです。webroot/bootstrap_u_i/ の bootstrapを最新にしましょうー

あと、

bootstrapテンプレートはdashboardだけでなく cover, signin も作ってくださっております(感謝)signinは↓

bin/cake bake template [CONTROLENAME] login -t BootstrapUI

詳しいusageはこちら

FriendsOfCake/bootstrap-ui
https://github.com/FriendsOfCake/bootstrap-ui

CakePHP
https://book.cakephp.org/5/ja/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?