Class 'App\Product' not found (ok)

C:\xampp\htdocs\blog\app\Product.php

<?php
  
namespace App;
  
use Illuminate\Database\Eloquent\Model;
   
class Product extends Model
{
    
}
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Input;
use Redirect;
use Validator;
use App\Product;
class ProductController extends Controller {
  /**
   * Display a listing of the resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function getPostDetail($id) {
    $post = Product::find($id); //trả về một instance model
    echo '<pre>';
      var_export($post);
    echo '</pre>';
    die();
  }
}

Last updated