1
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.

Laravelとdocker よく打つコマンド

Last updated at Posted at 2022-02-25

コマンドいちいちぐぐるのめんどいので、自分用メモ

Laravel

キャッシュクリア

php artisan cache:clear &&
php artisan config:clear &&
php artisan route:clear &&
php artisan view:clear &&
php artisan clear-compiled &&
php artisan optimize &&
rm -f bootstrap/cache/config.php &&
composer dump-autoload 

make model

php artisan make:model Writer -mc

make controller

php artisan admin:make GenreController --model=App\\Genre

make migration

php artisan make:migration create_brands_table -mc

migration 1つだけ実行

php artisan migrate:refresh --step=1 --path=/database/migrations/2022_08_14_222951_create_follow_users_table.php

開発環境のみ

php artisan migrate:refresh

add column

php artisan make:migration add_closed_flg_to_schools_table --table=schools
$table->string('closed_flg')->nullable()->after('city_id');

migration 1つだけ実行

php artisan migrate:refresh --step=1 --path=/database/migrations/2022_08_14_222951_create_follow_users_table.php

seeder

php artisan db:seed
php artisan db:seed --force
php artisan db:seed --class=TimelineSeeder

Laravel admin

make controller

php artisan admin:make PlanController --model=\App\\Models\\Plan
php artisan admin:make UserController --model=App\User

docker

ビルド

docker-compose build
docker-compose up -d --build

ログイン

docker exec -it container_name bash

DocumentRoot書き換え

vim /etc/apache2/sites-available/000-default.conf
/etc/init.d/apache2 restart

docker起動時DB接続できない時

alter user 'root'@'%' identified with mysql_native_password by 'root';

sql通す

mysql -u root -proot db_name < /usr/local/etc/mysql.sql

コンテナ作成

docker run -i -t -d -v /Users/mirei_hayase/git/:/home/git --name container_name -p 8080:80 -p 3300:3306 --privileged centos:centos7 /sbin/init
1
0
1

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
1
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?