laravelでUser:all()などで使う、all()メソッドの中身を確認してみました。
以下がコードなのですが、all()の引数にある$columns = ['*']とは何なのですか?
allって引数を受け取れるのでしょうか?
また、return (new static)となっているところもよくわかりません。
こういう表記はそもそもみたことないのですが、どういった記法でしょうか?
/** * Get all of the models from the database. * * @param array|mixed $columns * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function all($columns = ['*']) { return (new static)->newQuery()->get( is_array($columns) ? $columns : func_get_args() ); }

回答1件
あなたの回答
tips
プレビュー