简体   繁体   中英

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `jobs`) 11

Could someone find me a fix Error is $jobs = Job::all(); ?

Shared files https://1drv.ms/f/s!AnPb5n9nCL2ipyH_Wu61GVkT-Xk

 <?php
 
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
use App\Job;
 
class JobController extends Controller
{
    public function index(){
  //here'$jobs = Job::all();
        return view('welcome',compact('jobs'));
    }
    public function show($id,Job $job){
        return view('jobs.show',compact('job'));
    }
} 

set these 2 options in your job model, you can check official laravel documentation

$table requires string value of your table name and $fillable requires an array of column names of your job table

protected $table
protected $fillable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM