mardi 17 avril 2018

Laravel 5.6 Reflection Exeption - Class App\Providers\App\Campaign does not exist

This thing has got me stumped.

I get this error/Reflection Exception -> Class App\Providers\App\Campaign does not exist

Campaign is a class created for the app.

What's weird is that this error only shows up when I use a "show" resource route. When I list it using the "index" route. I get no errors.

Here's the class:


namespace App;

use Illuminate\Database\Eloquent\Model;

class Campaign extends Model
{
protected $table='campaigns';
protected $primaryKey = 'campaignID';
protected $fillable = [
    'campaignID',
    'campaignName',
    'shortDescription',
    'longDescription',
];

public function company(){
    return $this->belongsTo('App\Company','companyID','companyID');
}

    public function person(){
    return $this->belongsTo('App\Person','campaignID','campaignID');
    }
}


and here's the "show" function from the controller


public function show(Campaign $campaign)
{
    $campaign = Campaign::find($campaign->campaignID);
    return view('campaigns.show', ['campaign'=>$campaign]);
}


I've already cleared the cache and "composer dump-autoload" to no avail.

Thanks for any help you guys can give.

Jeeves





Aucun commentaire:

Enregistrer un commentaire