Featured image of post 一些關於Laravel的小提示

一些關於Laravel的小提示

專案打開出現錯誤

嘗試 Composer update OR Composer i

You can also run php --ini in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with --ignore-platform-req=ext-fileinfo to temporarily ignore these required extensions.

到php底下找到php..ini解開 extension=fileinfo

Laravel 專案運行 php artisan serve 出現 “Your requirements could not be resolved to an installable set of packages”

1
composer install --ignore-platform-reqs

or

1
composer update --ignore-platform-reqs

Composer 版本更新

更新至 2.0 只要執行以下命令

1
composer self-update --2

使用 composer self-update –rollback 返回到 1.10.10 版本

1
composer self-update --1 

網頁顯示Debug模式

laravel/config/app.php

‘debug’ => (bool) env(‘APP_DEBUG’, false),

->

‘debug’ => (bool) env(‘APP_DEBUG’, true),


要裝XML套件

1
composer require mtownsend/response-xml

要安裝SQl Server Reporting Servers 套件

1
composer require chartblocks/php-ssrs

遇到Fatal error: Class ‘SoapClient’ not found

  1. 到C:/xampp/php中php.ini
  2. extension=soap前面的;移除掉即可

遇到In ProviderRepository.php line 208: Class ‘Elibyy\TCPDF\ServiceProvider’ not found

1
composer require elibyy/tcpdf-laravel

PostgreSQL

https://tonyfrenzy.medium.com/using-postgresql-with-laravel-c4c320ca7f34

請至php.ini解開 extension=pdo_pgsql & extension=pgsql


遇到下列錯誤:

Your requirements could not be resolved to an installable set of packages.

Problem 1 - laravel/framework[v7.29.0, …, 7.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, …, 1.x-dev]. - Root composer.json requires laravel/framework ^7.29 -> satisfiable by laravel/framework[v7.29.0, …, 7.x-dev].

To enable extensions, verify that they are enabled in your .ini files: - C:\php-8.0.6\php.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

你必須操作以下:

First of all, stop the XAMPP/Wamp and then kindly remove the starting semicolon ( ; ) from your xampp\php\php.ini the following code.

;extension=fileinfo


遇到下列問題:

Undefined constant PDO::MYSQL_ATTR_LOCAL_INFILE

你必須操作下列

In your php.ini file, you should have the following line (uncommented):

extension=php_pdo_mysql.dll on Windows extension=php_pdo_mysql.so on Linux/Mac


laravel 安裝login laravel/ui

取得ui安裝包

1
composer require laravel/ui

安裝基本框架

1
2
3
4
5
6
7
8
9
php artisan ui bootstrap

or

php artisan ui vue

or

php artisan ui react

安裝登入&註冊框架

1
2
3
4
5
6
7
8
9
php artisan ui bootstrap --auth

or

php artisan ui vue --auth

or

php artisan ui react --auth
1
npm install

如果要測試可以先

1
npm run dev

or

1
npm run build

最後進行資料庫遷移

1
php artisan migrate

run server

1
php artisan serve

laravel nginx ubuntu server

https://blog.gtwang.org/linux/ubuntu-linux-laravel-nginx-mariadb-installation-tutorial/


Laravel Visual Studio Code Alt+Shift+F for blade

需要安裝插件

Laravel Blade Snippets和Beautify

MAC 上方列->喜好設定->設定 (快捷鍵) control+option+command+ㄝ

Windows 文件->首選項->設定 (快捷鍵) Ctrl+,

Search “beautify” –> ”點擊“ 在settings:json中編輯

滑到最下面 把這段json複製粘貼到settings.json的最後一行即可

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"beautify.language":{
        "js": {
            "type": [
                "javascript",
                "json",
                "jsonc"
            ],
            "filename": [
                ".jshintrc",
                ".jsbeautifyrc"
            ]
        },
        "css": [
            "css",
            "less",
            "scss"
        ],
        "html": [
            "htm",
            "html",
            "blade"
        ]
    },
使用 Hugo 建立
主題 StackJimmy 設計