fix: resolve cat_name exception and correct model relationships
This commit is contained in:
@@ -502,7 +502,8 @@ class PagesController extends Controller
|
||||
public function awardcategories(Request $category_req)
|
||||
{
|
||||
if (!$category_req->category) {
|
||||
return view('awardcategories');
|
||||
$categories = CarShowCategory::all();
|
||||
return view('awardcategories', ['categories' => $categories]);
|
||||
}
|
||||
$category = $category_req->category;
|
||||
if ($category_req->has('vehtype')) {
|
||||
|
||||
@@ -24,11 +24,11 @@ class CarShowWinner extends Model
|
||||
|
||||
public function awardVehicle()
|
||||
{
|
||||
return $this->hasMany('App\Models\Vehicles', 'id', 'vehicle');
|
||||
return $this->belongsTo('App\Models\Vehicles', 'vehicle', 'id');
|
||||
}
|
||||
|
||||
public function awardCategory()
|
||||
{
|
||||
return $this->hasMany('App\Models\CarShowCategory', 'id', 'category');
|
||||
return $this->belongsTo('App\Models\CarShowCategory', 'category', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ class VehicleScores extends Model
|
||||
|
||||
public function scoredVehicle()
|
||||
{
|
||||
return $this->hasMany('App\Models\Vehicles', 'id', 'vehicle');
|
||||
return $this->belongsTo('App\Models\Vehicles', 'vehicle', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user