jeudi 19 décembre 2019

How can i fix " Class 'App\Service' not found "

in local host i haven't this problem but in linux host in CPannel i receive this error

Class 'App\Service' not found

it's just an example i have same problem in some models..

my relations doesnt work properly in original host but in local host i haven't got any problem

my models:

<?php


namespace App;

use App\Category;

use App\Project;

use App\Service;

use Illuminate\Database\Eloquent\Model;


class Category extends Model

{

    protected $fillable = [

        'title', 'parent_id','title_en',
    ];


    public function category(){
        return  $this->hasMany(Category::class,'parent_id');
    }

    public function parent(){
        return $this->category('parent');
    }

    public function project(){
        return $this->belongsToMany(project::class);
    }

    public function service(){
        return $this->belongsToMany(service::class);
    }
}

my controller :

namespace App\Http\Controllers;


use App\Service;

use Illuminate\Http\Request;


class ServiceController extends Controller
{

    public function landpage(){

        $services=Service::with('cat')->get();


        return view('services.index',compact('services'));
    }

    public function detail($id){

        $services=service::with('cat')->findOrFail($id);

        return view('service_detail.index',compact('services'));

    }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire