I'm pretty new to using Swagger. Since my project is with Laravel, I use Swaggerevel to document my API. During I tried to generate as follows,
./vendor/bin/swagger app/ -o storage/docs/api-docs.json
It shows that
[INFO] Required #SWG\Info() not found
get /api/resource.json
-----------------------
1 operations documented
-----------------------
Written to /home/admin/api/gevme-api/storage/docs/api-docs.json
When I tried to access, It localhost:8000/docs, It properly show json api which I generated. But when I tried to access localhost:8000/api-docs, the same error message show again.
ErrorException in Logger.php line 38:
Required #SWG\Info() not found
in Logger.php line 38
at HandleExceptions->handleError('1024', 'Required #SWG\Info() not found', '/home/admin/api/gevme-api/vendor/zircote/swagger-php/src/Logger.php', '38', array('entry' => 'Required #SWG\Info() not found', 'type' => '1024'))
at trigger_error('Required #SWG\Info() not found', '1024') in Logger.php line 38
at Logger->Swagger\{closure}('Required #SWG\Info() not found', '1024')
at call_user_func(object(Closure), 'Required #SWG\Info() not found', '1024') in Logger.php line 68
at Logger::notice('Required #SWG\Info() not found') in AbstractAnnotation.php line 365
at AbstractAnnotation->validate() in Analysis.php line 284
at Analysis->validate() in functions.php line 46
at Swagger\scan('/home/admin/api/gevme-api/modules/Api', array('exclude' => array('/home/admin/api/gevme-api/storage', '/home/admin/api/gevme-api/tests', '/home/admin/api/gevme-api/resources/views', '/home/admin/api/gevme-api/config', '/home/admin/api/gevme-api/vendor'))) in routes.php line 39
at SwaggervelServiceProvider->{closure}()
at call_user_func_array(object(Closure), array()) in Route.php line 155
at Route->runCallable(object(Request)) in Route.php line 130
at Route->run(object(Request)) in Router.php line 704
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in OAuthExceptionHandlerMiddleware.php line 36
at OAuthExceptionHandlerMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(OAuthExceptionHandlerMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/home/admin/api/gevme-api/public/index.php') in server.php line 21
The problem is - you're missing the #SWG\Info block.
It's a block which tells swagger some most common information about your API.
I usually put this in a separate controller which is rendering swagger JSON.
Here's an example:
/**
* #SWG\Swagger(
* schemes={"http","https"},
* host="api.host.com",
* basePath="/",
* #SWG\Info(
* version="1.0.0",
* title="This is my website cool API",
* description="Api description...",
* termsOfService="",
* #SWG\Contact(
* email="contact#mysite.com"
* ),
* #SWG\License(
* name="Private License",
* url="URL to the license"
* )
* ),
* #SWG\ExternalDocumentation(
* description="Find out more about my website",
* url="http..."
* )
* )
*/
class SwaggerController extends...
If this happens to you, and you have the Swagger definition in the controller etc but still aren't seeing the comments make sure you don't have the following settings in your opcache configuration:
opcache.save_comments=1
opcache.load_comments=1
The settings above remove and not-load the docblox needed for swagger to create the documentation.
For Laravel 5.6 I launched
composer require darkaonline/l5-swagger:5.6
and quietly installed version 5.6.0 (which was linked to zircote/swagger-php version TWO), and I got subj error having #OA\Info block in Controller even.
When I runned
composer require darkaonline/l5-swagger:5.6.9
and increased version of zircote/swagger-php to
composer require zircote/swagger-php:3.0.2
my problem was solved
Related
So I am getting this error. After searching the internet it looks like the issue could be with the post_upload_size and post_size, but that's not it.
I upload larger images that work fine, then this image that has 1.5MB is not working. It's like it's random. It works for some, but not for all images. Here's the full output.
Whoops, looks like something went wrong:
1/1 NotReadableException in Decoder.php line 46: Unable to read image from file (/tmp/phpVpVQeP).
in Decoder.php line 46
at Decoder->initFromPath('/tmp/phpVpVQeP') in AbstractDecoder.php line 293
at AbstractDecoder->init('/tmp/phpVpVQeP') in AbstractDriver.php line 64
at AbstractDriver->init('/tmp/phpVpVQeP') in ImageManager.php line 50
at ImageManager->make('/tmp/phpVpVQeP') in Facade.php line 215
at Facade::__callStatic('make', array('/tmp/phpVpVQeP')) in ProfileController.php line 251
at Image::make('/tmp/phpVpVQeP') in ProfileController.php line 251
at ProfileController->sendProfile(object(Request), 'klaughlin')
at call_user_func_array(array(object(ProfileController), 'sendProfile'), array(object(Request), 'username' => 'klaughlin')) in Controller.php line 256
at Controller->callAction('sendProfile', array(object(Request), 'username' => 'klaughlin')) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(ProfileController), object(Route), 'sendProfile') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(ProfileController), object(Route), object(Request), 'sendProfile') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\ProfileController', 'sendProfile') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Cors.php line 18
at Cors->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Cors), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
Here is my var_dump
object(Symfony\Component\HttpFoundation\File\UploadedFile)#30 (7) { ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> bool(false) ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(19) "20160212_124938.jpg" ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(10) "image/jpeg" ["size":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(1606199) ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(0) ["pathName":"SplFileInfo":private]=> string(14) "/tmp/phpVpVQeP" ["fileName":"SplFileInfo":private]=> string(9) "phpVpVQeP" } string(14) "1483214733.jpg" string(76) "/home/laughlindavid/public_html/mealog.com/public/profilepics/1483214733.jpg"
It is odd how it just does this with certain images.
Here is the code in my controller.
$image = Input::file('picture');
var_dump($image);
$filename = time() . '.' . $image->getClientOriginalExtension();
var_dump($filename);
$path = public_path('profilepics/' . $filename);
var_dump($path);
Image::make($image->getRealPath())->resize(200, 200)->save($path);
I had the same problem. I've solved the problem after installing imagick driver and setting driver to imagick (config/image.php) instead of GD.
This error may have many different solutions, but I'm hoping this will help someone out there. The short answer was that my php version which is 5.6 throws a gd.jpeg warning which probably caused it to not show as a gd resource when I did a var_dump in my intervention image Decoder.php file. Maybe using image Imagick driver instead of GD driver would have fixed this issue. BUT I USED THIS TO IGNORE THE WARNING, which PHP VERSION 1.7 now does automatically.
ini_set ('gd.jpeg_ignore_warning', 1);error_reporting(E_ALL & ~E_NOTICE);
So horray! My now all images uploaded consistently, but there was another issue I think related to this. My images had EXIF data in them which caused some of them to rotate automatically which was strange. Luckily Intervention Image has a method for this "orientate()" which I use when I create my image. Here's my new code in controller.
$image = $picture;
echo '<br>';
$filename = time() . '.' . $image->getClientOriginalExtension();
$path = public_path('profilepics/' . $filename);
$imageMoved = $image->move(public_path('profilepics'), $filename);
ini_set ('gd.jpeg_ignore_warning', 1);
error_reporting(E_ALL & ~E_NOTICE);
Image::make($path)->resize(200,200)->orientate()->save($path);
I really hope this saves you the major time I spent reading through totally different issues throwing the same error. My advice would be to var dump the crap out of the files your errors are coming from and compare (at least for my case) the working images from the non-working ones. Peace and Happy Coding!
I'm trying to create a Job, but when i set the line:
protected $param;
to pass the data from __construct to handle() I start getting this error:
Class not found
When I removed the protected $param; line, the Job works perfectly. But I'm not able to get the data. What can I do to fix this?
<?php
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Repositories\ProductRepository;
class ImportProducts extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
protected $param;
/**
* Create a new job instance.
*
* #return void
*/
public function __construct($param)
{
$this->param = $param;
}
/**
* Execute the job.
*
* #return void
*/
public function handle()
{
//$products = $this->param['products'];
exit();
}
}
This is the entire error message:
Whoops, looks like something went wrong.
1/1
ReflectionException in Container.php line 734:
Class does not exist
in Container.php line 734
at ReflectionClass->__construct('') in Container.php line 734
at Container->build('', array()) in Container.php line 629
at Container->make('', array()) in Application.php line 697
at Application->make('') in Job.php line 154
at Job->resolve('') in Job.php line 210
at Job->failed() in SyncQueue.php line 153
at SyncQueue->handleFailedJob(object(SyncJob)) in SyncQueue.php line 36
at SyncQueue->push(object(ImportProducts), '', 'upload_products_file') in Queue.php line 40
at Queue->pushOn('upload_products_file', object(ImportProducts)) in Dispatcher.php line 135
at Dispatcher->pushCommandToQueue(object(SyncQueue), object(ImportProducts)) in Dispatcher.php line 117
at Dispatcher->dispatchToQueue(object(ImportProducts)) in Dispatcher.php line 66
at Dispatcher->dispatch(object(ImportProducts)) in DispatchesJobs.php line 17
at Controller->dispatch(object(ImportProducts)) in ProductController.php line 656
at ProductController->importProducts(object(Request))
at call_user_func_array(array(object(ProductController), 'importProducts'), array(object(Request))) in Controller.php line 80
at Controller->callAction('importProducts', array(object(Request))) in ControllerDispatcher.php line 146
at ControllerDispatcher->call(object(ProductController), object(Route), 'importProducts') in ControllerDispatcher.php line 94
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(ProductController), object(Route), object(Request), 'importProducts') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\ProductController', 'importProducts') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
When a job use SerializesModels trait expect a Eloquent model in the constructor.
You gave something different from an Eloquent Model in the constructor and Laravel, because the trait SerializesModels is trying to reconstruct the Eloquent object from the class of $param, but it cannot find it.
Try to remove SerializesModels from the traits of the job.
I'm getting this error, while trying to access a page that I've added in my routes..
ex. laravel.com/about-us
here's a sample of my routes code.
I was asked to do the routes in config.php
'about-us' => [
'controller' => 'page',
'method' => 'about',
'enable' => true
],
and a method like this.
public function about() {
return view($this->getViewPrefix() . '::page.about');
}
The ful error:
NotFoundHttpException in Application.php line 879:
in Application.php line 879
at Application->abort('404', '', array()) in helpers.php line 21
at abort('404') in helpers.php line 45
at cd_abort('404') in routes.php line 93
at ServiceProvider->{closure}('about-us')
at call_user_func_array(object(Closure), array('param1' => 'about-us')) in Route.php line 155
at Route->runCallable(object(Request)) in Route.php line 130
at Route->run(object(Request)) in Router.php line 704
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
I personally don't think it's how I did these things, because one of my colleagues got two of these pages to work, (they only have two) ..
does this have to do with my installation, or maybe my OS lol.?
I don't think you can write routes in config file. You have to write your routes in this file app/Http/routes.php Write these lines
Route::get('about-us', [
'as' => 'aboutUs', 'uses' => 'PagesController#about'
]);
Write your controller's name instead of PagesController. You have to make your controller inside this folder app/Http/Controllers
Laravel has the routes.php file to contain all the application related routing. This file will be autoloaded when the application runs.
Therefore, include your routing in this file for best practice.
A "get" routing will be like:
Route::get('/about-us', [ 'as' => 'about', 'uses' => 'PagesController#about']);
Similarly a 'post' routing:
Route::post('/about-us', [ 'as' => 'about', 'uses' => 'PagesController#about']);
Remember to name the controller file as "PagesController". Its the proper naming convention.
"#about" is the method in the PagesController that will handle the logic.
For better understanding: Laravel Routing
Hope this is helpful.
I'm new to laravel and am currently stuck when trying to send an email like this:
Mail::send('emails.pwreset', $mydata, function ($message) use ($mydata) {
$message->from('foo#bar.de', 'Password reset');
how can I enable/configure the mailing function?
here's my laravel error message:
Swift_TransportException in StreamBuffer.php line 294: Process could not be started [Das System kann den angegebenen Pfad nicht finden.
]
in StreamBuffer.php line 294
at Swift_Transport_StreamBuffer->_establishProcessConnection() in StreamBuffer.php line 58
at Swift_Transport_StreamBuffer->initialize(array('timeout' => '30', 'blocking' => '1', 'command' => '/usr/sbin/sendmail -bs', 'type' => '16')) in AbstractSmtpTransport.php line 113
at Swift_Transport_AbstractSmtpTransport->start() in SendmailTransport.php line 51
at Swift_Transport_SendmailTransport->start() in Mailer.php line 79
at Swift_Mailer->send(object(Swift_Message), array()) in Mailer.php line 398
at Mailer->sendSwiftMessage(object(Swift_Message)) in Mailer.php line 188
at Mailer->send('emails.pwreset', array('passwort' => 'WVSSV', 'empf' => 'foo#bar.de'), object(Closure)) in Facade.php line 216
at Facade::__callStatic('send', array('emails.pwreset', array('passwort' => 'WVSSV', 'empf' => 'foo#bar.de'), object(Closure))) in ResetpwController.php line 58
at Mail::send('emails.pwreset', array('passwort' => 'WVSSV', 'empf' => 'foo#bar.de'), object(Closure)) in ResetpwController.php line 58
at ResetpwController->resetted(object(Request))
at call_user_func_array(array(object(ResetpwController), 'resetted'), array(object(Request))) in Controller.php line 256
at Controller->callAction('resetted', array(object(Request))) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(ResetpwController), object(Route), 'resetted') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(ResetpwController), object(Route), object(Request), 'resetted') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Resetpw\ResetpwController', 'resetted') in Route.php line 201
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 704
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
It looks like /usr/sbin/sendmail does not exist. Is sendmail installed and properly configured?
Also check the Swift Mailer settings inside your application.
I'm attempting to simply send a 'PUT' request to one of my routes (which is called as a resource in the route file), yet I recieve this traceback as the response.
Whoops, looks like something went wrong.
1/1 BadMethodCallException in Controller.php line 273: Method [show] does not exist.
in Controller.php line 273
at Controller->__call('show', array('1'))
at AccountControllerV2->show('1')
at call_user_func_array(array(object(AccountControllerV2), 'show'), array('account' => '1')) in Controller.php line 246
at Controller->callAction('show', array('account' => '1')) in ControllerDispatcher.php line 162
at ControllerDispatcher->call(object(AccountControllerV2), object(Route), 'show') in ControllerDispatcher.php line 107
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108
at ControllerDispatcher->callWithinStack(object(AccountControllerV2), object(Route), object(Request), 'show') in ControllerDispatcher.php line 67
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\API\V2\AccountControllerV2', 'show') in Route.php line 198
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 131
at Route->run(object(Request)) in Router.php line 692
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Authenticate.php line 47
at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Router.php line 694
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 661
at Router->dispatchToRoute(object(Request)) in Router.php line 619
at Router->dispatch(object(Request)) in Kernel.php line 214
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in HttpsProtocol.php line 15
at HttpsProtocol->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 115
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53
I cannot for the life of me figure out why this is happening.
Here is a code snippet from the Controller itself (which extends BaseController):
/**
* Update the currently logged User in storage.
*
* #return Response 201
* #return jsonArray account
* #return string message
*/
public function update($account_id) {
$input = Input::all();
$message = 'Account Successfully Updated';
$user = Auth::User();
And here is the Route declaration:
Route::group(array('prefix' => 'api/v2', 'namespace' => 'API\V2', 'middleware' => 'auth'), function()
{
Route::resource('challenges', 'ChallengeControllerV2', ['only'=> ['index','store','update','destroy']]);
Route::resource('groups', 'GroupControllerV2');
Route::resource('account', 'AccountControllerV2');
The call is being made to the correct path. Any ideas why I'm getting what seems to be an illogical response? There is no additional middleware/filters attached to the controller than what is shown.
It turns out that in Laravel 5 if you do not specify the resources available on a Route it will assume that they are all there (unlike in Laravel 4 where it checks to see what resources are available in all controllers). So I had to change the line like so.
Route::resource('account', 'AccountControllerV2', ['only'=> ['index','update','destroy']]);