Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

with this

<?php

namespace App\Http\Controllers;

use App\Pays;
use Illuminate\Http\Request;
use App\Societe;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class SocieteController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        //
        $data['societes'] = Societe::with('payss')->get();
        //$societes=Societe::all();
        $data['page_title'] = 'Sociétés';
        return view('societes.index',compact('societes'))->with($data);
    }

FatalErrorException in Model.php line 732: Class 'Pays' not found

0

you do realise you seem to have a type in your Pays Model?

,,, public function Payss() ,,,

notice payss

0

hi,

I found ! it's not about payss, it's because, you need to use return $this->belongsTo('App\Pays'); and not $this->belongsTo('Pays');

:)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

guil182 guil182 Joined 1 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.