Lara帳
こちらを進めています。
tinkerで$articles = User::find(1)->articles();
と打ち込んだところPHP Fatal error: Class 'User' not found in eval()'d code on line 1と返ってきます。
app\User.php
<?php namespace App; use Illuminate\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class User extends Model implements AuthenticatableContract,CanResetPasswordContract // AuthorizableContract, { public function articles() { return $this->hasMany('App\Article'); } use Authenticatable, Authorizable, CanResetPassword; /** * The database table used by the model. * * @var string */ protected $table = 'users'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name', 'email', 'password']; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = ['password', 'remember_token']; }
class User で追加してあるはずなのにfatal エラーが何故返ってくるのでしょうか・・・。
できるならこのまま(34)まで終わらせたいのですが参考にする物を変えたほうがいいのでしょうか。ご教示ください。
.env
APP_ENV=local APP_DEBUG=true APP_KEY=3BeZmW7Eu7ArtxToJOtT5EM1SkvLqVgn DB_CONNECTION=sqlite DB_HOST=localhost DB_DATABASE=database DB_USERNAME=homestead DB_PASSWORD=secret CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_ENCRYPTION=ssl MAIL_FROM_ADDRESS=your_address@gmail.com MAIL_FROM_NAME=your_name MAIL_USERNAME=your_address@gmail.com MAIL_PASSWORD=your_password MAIL_PRETEND=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET=
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/09/17 04:41 編集
2017/09/17 05:48
退会済みユーザー
2017/09/17 05:54
2017/09/17 05:59
退会済みユーザー
2017/09/17 07:47 編集
退会済みユーザー
2017/09/17 09:38 編集
2017/09/17 11:42
退会済みユーザー
2017/09/17 11:56 編集
2017/09/17 12:02 編集
退会済みユーザー
2017/09/17 12:06
2017/09/17 12:13
2017/09/17 12:15
退会済みユーザー
2017/09/17 12:23
2017/09/17 12:32
退会済みユーザー
2017/09/17 12:40
2017/09/17 12:46
退会済みユーザー
2017/09/17 12:56 編集
2017/09/17 13:09
2017/09/17 13:16 編集
退会済みユーザー
2017/09/17 13:23 編集