I have created new Class Called "song".
Location of the class app/ClassName , so its app/songs.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Song extends Eloquent {
//put your code here
}
My Route:
Route::get('/','SongsController@index');
My SongsController.php location: app/Http/controller/SongsController.php
Wanting to correspond my database table called "songs".
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Song;
class SongsController extends Controller
{
public function index()
{
$songs = Song::get();
return view('pages.songsList',compact('songs'));
}
Now with all these code, I get a simple error says as below,
FatalErrorException in SongsController.php line 19:
Class 'App\Song' not found
If I use without adding class "Song" model works fine. The code is as below
DB::table('songs)->get();
Thanks in Advance, Sorry I am new to Lavaral 5.
songand file is calledsongs. They need to match. It should beSong.php