前提・実現したいこと
OS:Windows7
PHP7.2.6
Laravel5.6.26
https://beiznotes.org/making-task-list-with-laravel55-1/
こちらのサイトを参考に、Laravelでの簡単なプロジェクト作成・DB利用を行っています。
・アプリケーションで使用する空のデータベースhomesteadを作成
・タスクを保存するTasksテーブルをマイグレーションファイルに定義
・マイグレーション
・空のTaskモデルを定義
・3つの空のルートを作成
を終えたので、「php artisan serve」コマンドを実行して、
http://localhost:8000/にアクセスし、空のページを表示させたいです。
('/'ルートの中身が空なので、空のページが表示されるはずです。)
しかし、実行してみると「Attribute [port] does not exist.」
というエラーが発生します。
発生している問題・エラーメッセージ
以下、エラーログです。
[2018-07-03 02:31:21] local.ERROR: Attribute [port] does not exist. {"exception":"[object] (InvalidArgumentException(code: 0): Attribute [port] does not exist. at C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Routing\RouteRegistrar.php:91) [stacktrace] #0 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1224): Illuminate\Routing\RouteRegistrar->attribute('port', '/task') #1 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(221): Illuminate\Routing\Router->__call('port', Array) #2 C:\pleiades_php\xampp\htdocs\quickstart\ outes\web.php(24): Illuminate\Support\Facades\Facade::__callStatic('port', Array) #3 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Routing\Router.php(400): require('C:\\pleiades_php...') #4 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Routing\Router.php(356): Illuminate\Routing\Router->loadRoutes('C:\\pleiades_php...') #5 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Routing\RouteRegistrar.php(120): Illuminate\Routing\Router->group(Array, 'C:\\pleiades_php...') #6 C:\pleiades_php\xampp\htdocs\quickstart\app\Providers\RouteServiceProvider.php(56): Illuminate\Routing\RouteRegistrar->group('C:\\pleiades_php...') #7 C:\pleiades_php\xampp\htdocs\quickstart\app\Providers\RouteServiceProvider.php(40): App\Providers\RouteServiceProvider->mapWebRoutes() #8 [internal function]: App\Providers\RouteServiceProvider->map() #9 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array) #10 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #11 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #12 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #13 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php(74): Illuminate\Container\Container->call(Array) #14 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php(33): Illuminate\Foundation\Support\Providers\RouteServiceProvider->loadRoutes() #15 C:\pleiades_php\xampp\htdocs\quickstart\app\Providers\RouteServiceProvider.php(28): Illuminate\Foundation\Support\Providers\RouteServiceProvider->boot() #16 [internal function]: App\Providers\RouteServiceProvider->boot() #17 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array) #18 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #19 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #20 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #21 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(794): Illuminate\Container\Container->call(Array) #22 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(777): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\RouteServiceProvider)) #23 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\RouteServiceProvider), 18) #24 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(778): array_walk(Array, Object(Closure)) #25 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php(17): Illuminate\Foundation\Application->boot() #26 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(206): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application)) #27 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(297): Illuminate\Foundation\Application->bootstrapWith(Array) #28 C:\pleiades_php\xampp\htdocs\quickstart\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(120): Illuminate\Foundation\Console\Kernel->bootstrap() #29 C:\pleiades_php\xampp\htdocs\quickstart\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #30 {main} "}
該当のソースコード
app/Task.php(Tasksテーブルのモデル)
PHP
1<?php 2 3namespace App; 4 5use Illuminate\Database\Eloquent\Model; 6 7class Task extends Model 8{ 9 // 10} 11
routes/web.php
PHP
1/* 全タスクをリスト表示するルート(GETリクエスト) */ 2Route::get('/', function () { 3 // 4}); 5 6/* 新しいタスクを追加するルート(POSTリクエスト) */ 7Route::port('/task', function(Request $request) { 8 // 9}); 10 11/* 既存のタスクを削除するルート(DELETEリクエスト) */ 12Route::delete('/task/{task}', function(Task $task) { 13 // 14});
.evn
APP_NAME=Laravel APP_ENV=local APP_KEY=base64:5D7kU77O60rRdb4CRGV/Lz+lI+33br9oXkZWq7fhWoo= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=root DB_PASSWORD=seacret BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
試したこと
調べてみましたが、同じエラーに遭っている方・解決法のサイトは見つかりませんでした。
デフォルトのポート番号「8000」が被っていたり、利用できないのが問題かと思い、
実行コマンドを「php artisan serve --port=8080」のように、ポート番号を8001や9000等、いろいろな番号にして見ました、同じエラーでした。
スタックトレースを追ってみても、ポート番号に直接関わるようなメソッドに辿り着かず、原因がわかりません。
ご教授よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/03 04:36