我在 app\Models 中有这个模型 City.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
//
}
和这个 CityController.php
<?php
namespace App\Http\Controllers;
use App\Models\City;
use Illuminate\Http\Request;
class CityController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$cities = City::OrderBy('city_code')->get();
return view('testcities',compact('cities'));
}
但我在 laravel 中找回了这个错误:
找不到错误类“App\Models\City”
交互式爱情
守着一只汪