This question already has answers here:
Laravel view not found exception
(19 answers)
Closed 2 years ago.
I already deployed my Laravel app into my VPS. It works fine on localhost. I think the error is in my routes or maybe the controller because the path is still going into my local machine directory (see error message line 2) but I really can't see the problem in the code.
I have tried using php artisan config:cache, php artisan cache:clear, php artisan route:cache but it still doesn't work. It still refers to my local machine directory.
This is the directory of index.blade.php
Root
|-- portofolio
|-- app
|-- bootstrap
|-- config
|-- database
|-- resources
|-- assets
|-- lang
|-- views
|-- index.blade.php
|-- routes
|-- storage
|-- tests
|-- vendor
|-- public_html
|-- css
|-- img
|-- js
|-- vendor
This is the Route
Route::get('/', ['as' => 'home', 'uses' => 'Portofolio#link']);
This is the Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Portofolio extends Controller
{
public function link() {
$categories = [
'1' => 'Print Design',
'2' => 'Logo Design',
'3' => 'Web Design',
'4' => 'Product Design',
'5' => 'Character Design',
'6' => 'Packaging Design'
];
$projects = [
'1' => 'IMSAA Training Certificate',
'2' => 'Rusticity Logo',
'3' => 'Handy Production Website',
'4' => 'Nihon no Matsuri Bag Project',
'5' => 'The Chin - Captain Jack Sparrow',
'6' => 'Rusticity Packaging'
];
$images = [
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6'
];
$skills = [
'1' => 'Photoshop',
'2' => 'Ms. Office',
'3' => 'Laravel',
'4' => 'PHP',
'5' => 'HTML',
'6' => 'MySQL'
];
$points = [
'1' => '80%',
'2' => '90%',
'3' => '60%',
'4' => '60%',
'5' => '60%',
'6' => '60%'
];
return view('index')->withCategories($categories)->withProjects($projects)->withImages($images)->withSkills($skills)->withPoints($points);
}
}
This is the error message (see line 2)
InvalidArgumentException in FileViewFinder.php line 137:
View [index] not found.
1. in FileViewFinder.php line 137
2. at FileViewFinder->findInPaths('index', array('E:\Laravel\portofolio\resources\views')) in FileViewFinder.php line 79
3. at FileViewFinder->find('index') in Factory.php line 174
4. at Factory->make('index', array(), array()) in helpers.php line 856
5. at view('index') in Portofolio.php line 56
6. at Portofolio->link()
7. at call_user_func_array(array(object(Portofolio), 'link'), array()) in Controller.php line 55
8. at Controller->callAction('link', array()) in ControllerDispatcher.php line 44
9. at ControllerDispatcher->dispatch(object(Route), object(Portofolio), 'link') in Route.php line 190
10. at Route->runController() in Route.php line 144
11. at Route->run(object(Request)) in Router.php line 653
12. at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
13. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
14. at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
15. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
16. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
17. at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137
18. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
19. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
20. at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
21. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
22. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
23. at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
24. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
25. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
26. at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137
27. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
28. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
29. at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137
30. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
31. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
32. at Pipeline->then(object(Closure)) in Router.php line 655
33. at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 629
34. at Router->dispatchToRoute(object(Request)) in Router.php line 607
35. at Router->dispatch(object(Request)) in Kernel.php line 268
36. at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
37. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
38. at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
39. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
40. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
41. at Pipeline->then(object(Closure)) in Kernel.php line 150
42. at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
43. at Kernel->handle(object(Request)) in index.php line 54
I have solved the problem.
The problem is that my server is not being set up properly because the domain doesn't connect properly to my VPS. Contacted the hosting provider and the problem was solved.
If anyone have this problem just check
Have you already done php artisan config:cache or php artisan config:clear?
Did you name your view correctly as yourview.blade.php?
Did you place the view correctly in resources\views?
Make sure you have the index.blade.php in the views dir, here the index.blade.php is not the index.php in the / dir.
Related
i have problem in storing data of users ,when user sign up i store half of info in table user and other half in another table ,when hit register butttom i get that error i found that in table user info is stored correctley but in other table nothing is saved.
error
in HasAttributes.php line 818
at HandleExceptions->handleError(2, 'Illegal offset type', 'C:\\wamp\\www\\Menoon1\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Concerns\\HasAttributes.php', 818, array()) in HasAttributes.php line 818
at Model->getCasts() in HasAttributes.php line 803
at Model->hasCast('email', array('date', 'datetime')) in HasAttributes.php line 832
at Model->isDateCastable('email') in HasAttributes.php line 565
at Model->isDateAttribute('email') in HasAttributes.php line 525
at Model->setAttribute('email', 'dde#hg.com') in Model.php line 223
at Model->fill(array('email' => 'dde#hg.com')) in Model.php line 145
at Model->__construct(array('email' => 'dde#hg.com')) in Model.php line 268
at Model->newInstance(array('email' => 'dde#hg.com')) in Builder.php line 1030
at Builder->newModelInstance(array('email' => 'dde#hg.com')) in Builder.php line 723
at Builder->create(array('email' => 'dde#hg.com')) in Model.php line 1332
at Model->__call('create', array(array('email' => 'dde#hg.com'))) in Model.php line 1344
at user_emails->create(array('email' => 'dde#hg.com')) in Model.php line 1344
at Model::__callStatic('create', array(array('email' => 'dde#hg.com'))) in RegisterController.php line 94
at user_emails::create(array('email' => 'dde#hg.com')) in RegisterController.php line 94
at RegisterController->create(array('_token' => 'FZqd7Sc3fQRzmaQ0ImXYebzltzkygJsbKpNcZhv4', 'username' => 'vbnm v bnmm', 'email' => 'dde#hg.com', 'password' => '1111111', 'password_confirmation' => '1111111', 'fname' => 'vbn', 'lname' => 'bnm', 'address' => 'bnm', 'membership' => 'Normal', 'pic' => object(UploadedFile))) in RegistersUsers.php line 33
at RegisterController->register(object(Request))
at call_user_func_array(array(object(RegisterController), 'register'), array(object(Request))) in Controller.php line 55
at Controller->callAction('register', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(RegisterController), 'register') in Route.php line 204
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 561
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 520
at Router->dispatchToRoute(object(Request)) in Router.php line 498
at Router->dispatch(object(Request)) in Kernel.php line 174
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ValidatePostSize.php line 27
at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54
at require_once('C:\\wamp\\www\\Menoon1\\public\\index.php') in server.php line 21
user mode
public function useremail()
{
return $this->hasOne('App\user_emails');
}
other table code
public function user()
{
return $this->belongsTo('App\User');
}
code in registercontroller
protected function create(array $data)
{
$fileName = 'null';
Input::file('pic')->store('avatars');
if (Input::file('pic')->isValid()) {
$destinationPath = public_path('uploads/files');
$extension = Input::file('pic')->getClientOriginalExtension();
$fileName = uniqid().'.'.$extension;
Input::file('pic')->move($destinationPath, $fileName);
}
$user= User::create([
'fname' => $data['fname'],
'lname' => $data['lname'],
'address' => $data['address'],
'username' => $data['username'],
'membership' => $data['membership'],
'pic'=>$fileName,
'password' => bcrypt($data['password']),
]);
$useremail=user_emails::create(['email'=>$data['email']]);
// dd($useremail);
$user->useremail()->save($useremail);
return $user;
}
I dont know your model, but if has composite keys, collection cannot get attributes
Try
$user->useremail()->save(new UserEmail(['email'=>$data['email']]));
Given that the model of the useremail is UserEmail.
And your models are mixed up: it should be for App\UserEmail:
public function user()
{
return $this->belongsTo('App\User');
}
and for App\User
public function userEmail()
{
return $this->hasOne('App\user_emails');
}
Notice the convention, for your own good. 'useremail' becomes userEmail'. The model files become User.php and UserEmail.php. Your tables 'users' and 'user_emails' respectively. As thus, the relationship in 'user_emails' should be 'user_id'. And done.
I faced the same issue, it happened because in the Model I defined also a primary key, but it was already set in the database with a clause when the table was created.
when i try to register and send an email to the user i got this error. It was working till yesterday. From today it gives me this and i cant figure out why.
By the way on local testing this work's. I'm stuck. Help please
ErrorException in compiled.php line 7512:
file_put_contents(/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php): failed to open stream: Permission denied
in compiled.php line 7512
at HandleExceptions->handleError('2', 'file_put_contents(/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php): failed to open stream: Permission denied', '/var/www/html/bootstrap/cache/compiled.php', '7512', array('path' => '/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'contents' => 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ', 'lock' => false))
at file_put_contents('/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ', '0') in compiled.php line 7512
at Filesystem->put('/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ') in compiled.php line 15769
at BladeCompiler->compile('/var/www/html/resources/views/email/auth/activation.blade.php') in compiled.php line 15682
at CompilerEngine->get('/var/www/html/resources/views/email/auth/activation.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in compiled.php line 15517
at View->getContents() in compiled.php line 15505
at View->renderContents() in compiled.php line 15489
at View->render() in Mailer.php line 458
at Mailer->getView('email.auth.activation', array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in Mailer.php line 331
at Mailer->addContent(object(Message), 'email.auth.activation', null, null, array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in Mailer.php line 205
at Mailer->send('email.auth.activation', array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message)), object(Closure)) in Mailable.php line 117
at Mailable->send(object(Mailer)) in Mailer.php line 192
at Mailer->send(object(SendActivationToken)) in MailableMailer.php line 99
at MailableMailer->send(object(SendActivationToken)) in SendActivationEmail.php line 30
at SendActivationEmail->handle(object(UserRegistered))
at call_user_func_array(array(object(SendActivationEmail), 'handle'), array(object(UserRegistered))) in compiled.php line 10332
at Dispatcher->Illuminate\Events\{closure}(object(UserRegistered))
at call_user_func_array(object(Closure), array(object(UserRegistered))) in compiled.php line 10266
at Dispatcher->fire('App\Events\UserRegistered') in helpers.php line 480
at event(object(UserRegistered)) in AppServiceProvider.php line 25
at AppServiceProvider->App\Providers\{closure}(object(User))
at call_user_func_array(object(Closure), array(object(User))) in compiled.php line 10266
at Dispatcher->fire('eloquent.created: App\User', array(object(User))) in compiled.php line 11029
at Model->fireModelEvent('eloquent.created: App\User', false) in compiled.php line 10996
at Model->performInsert(object(Builder)) in compiled.php line 10941
at Model->save() in compiled.php line 10599
at Model::create(array('name' => 'Alessandro Mazari', 'surname' => 'Mazari', 'email' => 'alessandro.mazzari.v.l#gmail.com', 'password' => '$2y$10$R/lwIQ5.dgNgArYE3AuyGeDSyUWoILtnT2LvrDGNjV9aDevj9/Xnq', 'hidden_profile' => 'off', 'faction' => 'soon', 'mac_address_handlebar' => '', 'active' => false)) in RegisterController.php line 76
at RegisterController->create(array('_token' => 'Jeh3Amk6XGHDiFz5fqYyBIGYGblbNlZxwzM9r4lJ', 'name' => 'Alessandro Mazari', 'surname' => 'Mazari', 'email' => 'alessandro.mazzari.v.l#gmail.com', 'password' => 'alessa', 'password_confirmation' => 'alessa', 'faction' => 'soon', 'mac_address_handlebar' => '', 'hidden_profile' => 'off')) in compiled.php line 2695
at RegisterController->register(object(Request))
at call_user_func_array(array(object(RegisterController), 'register'), array(object(Request))) in compiled.php line 9584
at Controller->callAction('register', array(object(Request))) in compiled.php line 9611
at ControllerDispatcher->dispatch(object(Route), object(RegisterController), 'register') in compiled.php line 8665
at Route->runController() in compiled.php line 8646
at Route->run(object(Request)) in compiled.php line 8355
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10177
at SubstituteBindings->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 3312
at VerifyCsrfToken->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13749
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 12155
at StartSession->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13495
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13432
at EncryptCookies->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10054
at Pipeline->then(object(Closure)) in compiled.php line 8356
at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 8347
at Router->dispatchToRoute(object(Request)) in compiled.php line 8338
at Router->dispatch(object(Request)) in compiled.php line 2575
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 3374
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10054
at Pipeline->then(object(Closure)) in compiled.php line 2519
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2503
at Kernel->handle(object(Request)) in index.php line 53
I cannot comment because I have joined stackoverflow recently and I do not have enough credits so I post an answer.
Laravel needs write permission to storage folder ( and Just this folder). so please run:
sudo chmod -R 7777 storage
I hope I have helped,
regards,
Whenever you see something like failed to open stream: Permission denied', '/var/www/html/bootstrap/cache you should remind yourself that Laravel needs to have write permissions to specific directories.
sudo chmod 777 dir_name is your friend here :)
Quoting the docs:
Directory Permissions
After installing Laravel, you may need to configure some permissions.
Directories within the storage and the bootstrap/cache directories
should be writable by your web server or Laravel will not run.
I just upgraded from laravel 5.2 to laravel 5.3
Currently I have troubles with the Mailables.
I always receive the ReflectionException Class not found. The strange thing is that, when I try sending the mail directly (without queuing), no problems occur.
I reviewed the jobs table in my database, as I am using the database queuing driver. But that doesn't seems to be the issue.
Here is the full stacktrace:
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 699
at Application->make('') in Job.php line 83
at Job->resolve('') in Job.php line 149
at Job->failed(object(ReflectionException)) in SyncQueue.php line 168
at SyncQueue->handleFailedJob(object(SyncJob), object(ReflectionException)) in SyncQueue.php line 65
at SyncQueue->handleSyncException(object(SyncJob), object(ReflectionException)) in SyncQueue.php line 46
at SyncQueue->push(object(SendQueuedMailable)) in Mailable.php line 138
at Mailable->queue(object(QueueManager)) in Mailer.php line 211
at Mailer->queue(object(OrderReceived)) in MailableMailer.php line 127
at MailableMailer->queue(object(OrderReceived)) in VisitorController.php line 302
at VisitorController->_flushToDatabase(array('firstName' => 'Jules', 'lastName' => 'test', 'email' => 'demo#gmail.com', 'subscribe' => 'true', 'printTicketsByOrganisation' => 'true', 'tickets' => array(array('priceId' => '5947ed599e6a4e19bba0d9b54cb8a471', 'price' => '15.00', 'category' => 'Standaardprijs', 'seat' => '267', 'amount' => '1'), array('priceId' => '49f91249bff343f09cf1a90b9dd5cc1d', 'price' => '5-5.00', 'category' => 'Kinderen (GRATIS)', 'seat' => '266', 'amount' => '1'))), object(Request)) in VisitorController.php line 261
at VisitorController->ajaxPersist(object(Request))
at call_user_func_array(array(object(VisitorController), 'ajaxPersist'), array(object(Request))) in Controller.php line 52
at Controller->callAction('ajaxPersist', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(VisitorController), 'ajaxPersist') in Route.php line 190
at Route->runController() in Route.php line 144
at Route->run(object(Request)) in Router.php line 642
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TicketsAvailable.php line 25
at TicketsAvailable->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TicketsOpen.php line 29
at TicketsOpen->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Router.php line 644
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 618
at Router->dispatchToRoute(object(Request)) in Router.php line 596
at Router->dispatch(object(Request)) in Kernel.php line 263
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/home/jules/sites/tickets/public/index.php') in server.php line 21
My mailable class:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Event;
use App\Visitor;
use App\Organisation;
class OrderReceived extends Mailable
{
use Queueable, SerializesModels;
private $visitor;
private $event;
private $organisation;
private $bankingCode;
/**
* Create a new message instance.
* #param App\Visitor $visitor The visitor who bought the tickets
* #param App\Event $event The event where the visitor bought tickets from
* #param App\Organisation $organisation The organisation that hosts the event
* #param string $bankingCode The formatted banking code the user should use for payement
* #return void
*/
public function __construct(Visitor $visitor, Event $event, Organisation $organisation, $bankingCode)
{
$this->visitor = $visitor;
$this->event = $event;
$this->organisation = $organisation;
$this->bankingCode;
}
/**
* Build the message.
*
* #return $this
*/
public function build()
{
return $this->view('emails.visitor.payementRequestEmail')
->subject(trans('messages.emailPayementRequest'))
->with([
'langCode' => \App::getLocale(),
'eventName' => $this->event->name,
'organisationName' => $this->organisation->name,
'name' => $this->visitor->firstName.' '.$this->visitor->lastName,
'bankAccount' => chunk_split($this->organisation->bankAccount,4,' '),//format to ISO 13616
'bankingCode' => $this->bankingCode,
'url' => $this->organisation->url,
'color' => $this->organisation->colorAsHex,
'ticketAmount' => $this->visitor->seats()->count(),
'totalPrice' => $this->visitor->calculateTotalPrice(),
'email' => $this->organisation->email,
'userEmail' => $this->visitor->email,
'printedByOrganisation' => $this->visitor->printTicketsByOrganisation,
]);
}
}
And finally, the call to send the e-mail:
Mail::to($visitor->email)->queue(new OrderReceived($visitor, $event, $event->organisation()->first(), $humanBankingCode));
What am I doing wrong? Or is this a bug in Laravel?
After configuring the mail settings in config/mail.php, use the Mail class in your controller and place the below code
use Illuminate\Support\Facades\Mail;
or
use Mail;
Then execute the code. Its working fine for me.
I was trying to upgrade a Laravel 4.1 application to 5.1 on WAMP, and got this error:
RuntimeException in Request.php line 775: Session store not set on
request.
in
D:\wamp\www\laravel-5.1\vendor\laravel\framework\src\Illuminate\Http\Request.php
line 775 at Request->session() in
D:\wamp\www\laravel-5.1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php
line 137 at VerifyCsrfToken->addCookieToResponse(object(Request),
object(Response)) 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 124 at
Pipeline->Illuminate\Pipeline{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
30 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(BrowseController),
object(Route), object(Request), 'getBrowseRecent') in
ControllerDispatcher.php line 54 at
ControllerDispatcher->dispatch(object(Route), object(Request),
'App\Http\Controllers\BrowseController', 'getBrowseRecent') in
Route.php line 174 at Route->runController(object(Request)) in
Route.php line 140 at Route->run(object(Request)) in Router.php line
703 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)) in
ViewThrottleMiddleware.php line 55 at
ViewThrottleMiddleware->handle(object(Request), object(Closure)) at
call_user_func_array(array(object(ViewThrottleMiddleware), '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
30 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 705 at
Router->runRouteWithinStack(object(Route), object(Request)) in
Router.php line 678 at Router->dispatchToRoute(object(Request)) in
Router.php line 654 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
139 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 132 at
Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line
99 at Kernel->handle(object(Request)) in index.php line 54
The storage folder is writable, and the session driver used is file. I searched the whole project for session(), but found it nowhere. What can I do to correct this error? Thanks!
The session.php is as follows:
<?php
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => 120,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => null,
'secure' => false,
];
Edit 1: I found the problem is in the controller. There is a line:
$this->middleware('csrf', [ 'on' => 'post' ]);
I commented it out and it worked. But I didn't figure out why it caused the problem yet.
Look at #Cas Bloem his answer here this helped me out amazingly:
Laravel - Session store not set on request
That's why it wasn't working for me. Cause you're using a session that is expection matching CSRF tokens (is my best guess, I'm new to Laravel myself).
Also if you go to app->http->middleware->VerifyCsrfToken this is were you can add routes to the array that won't be checked for CSRF verification. This plus Cas Bloem his fix (place routes in different section in routes.php) fixed my problem. I'm just developing/learning on localhost right now but need to implement this later on.
Hope this helps/clears thing up!
I'm using Laravel 5. When editing a form a get this error
MethodNotAllowedHttpException
There are a few posts but I think it may be code specific. I'd rather not use the resource route methods if possible. Route:
Route::get('profile/edit', array('as' => 'admin.profile.edit', 'uses' => 'ProfileController#edit'));
Route::post('profile/edit', array('as' => 'admin.profile.update', 'uses' => 'ProfileController#update'));
The form is :
{!!Form::model($profile,array('method'=>'Patch','route' =>array('admin.profile.update'))) !!}
Controller:
public function update()
{
$user_id=$this->user->id;
$input=array_except(Input::all(),'_method');
Profile::where('user_id','=',$user_id)->update($input);
return Redirect::route('admin.profile.index');
}
Here is the error info:
n RouteCollection.php line 207
at RouteCollection->methodNotAllowed(array('GET', 'HEAD', 'POST')) in RouteCollection.php line 194
at RouteCollection->getRouteForMethods(object(Request), array('GET', 'HEAD', 'POST')) in RouteCollection.php line 142
at RouteCollection->match(object(Request)) in Router.php line 729
at Router->findRoute(object(Request)) in Router.php line 652
at Router->dispatchToRoute(object(Request)) in Router.php line 628
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 VerifyCsrfToken.php line 43
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->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
Thanks any help appreciated
Can you change this:
Route::post('profile/edit', array(
'as' => 'admin.profile.update',
'uses' => 'ProfileController#update'
));
To this:
Route::patch('profile/edit', array(
'as' => 'admin.profile.update',
'uses' => 'ProfileController#update'
));
I think your form action may need a matching route verb
http://laravel.com/docs/5.1/routing#basic-routing
For the second issue:
Column not found: 1054 Unknown column '_method' in 'field list' (SQL: update user_profile` set _method = PATCH, _token =
Add this to the top of your controller
use Illuminate\Http\Request;
Then update your method as so:
public function update(Request $request)
{
$user_id = $this->user->id;
$input = $request->except('_method', '_token');
Profile::where('user_id','=', $user_id)->update($input);
return Redirect::route('admin.profile.index');
}
In my case works adding protected $guarded = ['_token']; in Model file.