0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

laravel メモ

Last updated at Posted at 2022-11-06
laravel 常用コマンド
php artisan route:list
php artisan migrate
php artisan make:model Book

一時サーバ起動
php artisan serve --host=0.0.0.0 --port=8080

デバッグ
dd($val)

DB接続
psql -U postgres
DB今の状況を確認
php artisan migrate:status
DB作成
create database mydb;


-----------------------------------------------laravel バリデーション

blade
@for($i=0;$i<2;$i++)

<p><td><input type="text" id="i[{{$i}}]" name="n[{{$i}}]" value="{{ old('n.'.$i) }}" ></td></p>

@endfor


validate
public function rules()
{
    return [
        'n'.'.*'  => 'required|max:1',
    ];
}




-------------------Laravelで`Target class [〇〇Controller] does not exist.対応方法

Route::get('/hello','App\Http\Controllers\HelloController@index')

これで行けるはず



//----------DB 接続設定

php.ini

;for windows 設定
extension_dir = "C:\php\ext"

下記はコメントのままいいです
;extension=php_pdo_pgsql.dll
;外します
extension=php_pgsql.dll




<?php
// エラー表示あり
ini_set('display_errors', 1);

$host="host=127.0.0.1";
$port="port=5432";
$dbname="dbname=postgres";
$credentials="user=postgres password=test";

$db = pg_connect("$host $port $dbname $credentials");

if(!$db){
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
?>

実行
ブラウザでhttp://localhost/postgresql.phpを入力し、以下の画面を表示ならOK。
Opened database successfully
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?