I have started learning Laravel 5. Following this tutorial. I am getting this error. (Class 'App\Http\Controllers\Url' not found
).
I have attached the image of my code here.
Whoops, looks like something went wrong.
1/1
FatalErrorException in UrlController.php line 22:
Class 'App\Http\Controllers\Url' not found
in UrlController.php line 22
at FatalErrorException->__construct() in compiled.php line 1838
at HandleExceptions->fatalExceptionFromError() in compiled.php line 1833
at HandleExceptions->handleShutdown() in compiled.php line 0
at UrlController->store() in compiled.php line 8504
at call_user_func_array:{C:\wamp\www\readit-later\vendor\compiled.php:8504}() in compiled.php line 8504
at Controller->callAction() in compiled.php line 8572
at ControllerDispatcher->call() in compiled.php line 8551
at ControllerDispatcher->Illuminate\Routing\{closure}() in compiled.php line 9190
help me out.
You should create a model with the name Url or whatever suits best inside your app folder you may also generate a url model by artisan command
php artisan make:model Url
or you can create one manually e.g
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Builder;
protected $table = 'table_name' // in case your table name is different than plural of model name
class Url extends Model
{
}
and then in your controller use this Url model e.g
use App\Url;
and then you will be able to use
$url = new Url;
$url->url = Request::get('url'); //make sure you have used use Illuminate\Http\Request; in starting of your controller