Я был бы признателен за помощь в определении того, что не так. Я смотрел на это часами.Laravel 5: Невозможно найти класс в контроллере, «использовать приложение/что-то» указано в контроллере
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Controllers\App\Type' not found' in C:\wamp\www\Website\app\Http\Controllers\TripController.php:35.
Контроллер выглядит следующим образом:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Trip;
use App\Type;
use DB;
class TripController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function newTrip(Request $request)
{
//The sent info
$placeTypes = $request -> input('placeTypeString');
$user = $request -> input('id');
$placeTypesArrays = $request -> input('searchTypesCollectionArray');
//upload trip
Trip::create(['user_id' => $user, 'trip_type' => $placeTypes]);
//associate Trip with its types
$lastInsertedTripId = DB::table('trips')->orderBy('created_at', 'desc')->first();
$types = App\Type::all();
foreach ($placeTypesArrays as $arrayEntry)
{
foreach ($types as $type)
{
$typeName = $type->name;
if($typeName==$arrayEntry)
{
$Types->propertyOf()->attach($trip_id);
}
}
}
//upload
Trip::create(['user_id' => $user, 'trip_type' => $placeTypes]);
}
// //returns all posts in an app friendly manner
// public function indexJson()
// {
// //cache the search
// $result= Cache::remember("reply",1,function()
// {
// $posts = Post::orderBy('created_at', 'desc')->get()->first();
// return $posts;
// });
// return $result;
// }
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}
Модель записывается следующим образом:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Trip;
class Type extends Model
{
//
public function propertyOf()
{
return $this->belongsToMany('App\Trip');
}
}
вы уверены, что App \ Trip существует? потому что вы определяете App \ Type в конце своего cuestion, а не App \ Trip. –