My laravel 5.5 project works fantastic on wamp local server and doesn't have problem with BLADE templating.
but when I serve it on live server the BLADE template doesn't work properly and debug mode shows :
{
"message": "Undefined variable: user (View: /home/cafegamesepanta/laravel/resources/views/child.blade.php)",
"exception": "ErrorException",
"file": "/home/cafegamesepanta/laravel/storage/framework/views/4e1f0e4c5be0294bbdada500a5c395626107f4d8.php",
"line": 2,
"trace": [
//
notice that I just changed permissions of /strorage folder!
anyone can help? thanks
Clear all files in laravel/storage/framework/views.
Check that your controller has passed the User variable to views.
Check your database connection.
Related
Hi I'm trying to integrate paystack in laravel 8 but I'm click paynow button it give following error
Client error: POST https://api.paystack.co/transaction/initialize resulted in a 404 Not Found response:
{
"status": false,
"message": "Invalid Split code."
}
anyone can help how can i solve this
thanks
Can you share the request body? It looks like you're trying to pass a split code when you're initializing the transaction, but the code you're passing either:
Doesn't exist on that integration
Exists on the integration but maybe in test mode, and you're using your live keys (or in live mode and you're using your test keys)
I have build a Lingo game in Laravel. The app is hosted on Heroku: https://lingo-hu.herokuapp.com.
Whenever I click the 'Start Game'-button it should send a HTTP-POST-REQUEST to my WordController. After doing so it gives the following response:
"message": "Attempt to read property \"word\" on null",
"exception": "ErrorException",
"file": "/app/app/Http/Controllers/WordController.php",
"line": 23,
My WordController reference to the 'word'-model:
namespace App\Http\Controllers;
use App\word;
use App\game;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request;
class WordController extends Controller
{
}
However this action does work on my computer when running Laravel locally, just not on Heroku which I don't understand.
Console error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
app.js:699 Uncaught (in promise) Error: Request failed with status code 500
at createError (app.js:699)
at settle (app.js:960)
at XMLHttpRequest.handleLoad (app.js:168)
The database is up and running, I used php artisan migrate and that's working.
Anyone a suggestion on what I could be doing wrong?
The error was caused because the database table where the Word model was referring to was empty. So I imported an export from my MySQL database. Now it works!
Situation:
I've created a website that allows users to create their own simple sub-sites. Initially these are on sub-domains (i.e. newsite.websitecreator.com).These have SSL applied to them via a wildcard certificate *.websitecreator.com. All works fine!
I've also created a means of users being able to purchase a custom domain via an API or route their own domain to point to their subdomain. To achieve this a CNAME is created and pointed to the subdomain. This is routing and fine using an include line in the nginx config which includes all the custom domains:
include /home/forge/websitecreator.com/public/content/websitecreator-customer-domains.conf;
Issue
The main issue is the application of SSL to the custom domains. Obviously the SSL needs to be installed on the server, which has been tried through Forge's LetsEncrypt SSL option within the dashboard, with a view to using the Forge API for future LetsEncrypt when this is automated. However, this is giving me the following error:
Cloning into 'letsencrypt15721234230'...
ERROR: Challenge is invalid! (returned: invalid) (result: {
"type": "http-01",
"status": "invalid",
"error": {
"type": "urn:ietf:params:acme:error:unauthorized",
"detail": "Invalid response from http://newcustomdomain.co.uk/.well-known/acme-challenge/Da6CtvOTJnQVHQyENujDSih81TKuejKuaAWCWXsJKus [88.123.456.9]: \"\u003c!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Frameset//EN\\\" \\\"http://www.w3.org/TR/html4/frameset.dtd\\\"\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta http-eq\"",
"status": 403
},
"url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/995722342/n7xg9g",
"token": "Da6CtvOTJnQVhh2h3hn2jbSih81TKuejKuaAWCWXsJKus",
"validationRecord": [
{
"url": "http://newcustomdomain.co.uk/.well-known/acme-challenge/Da6CtvOTJnQVHQyENujDSih81TKuejKuaAWCWXsJKus",
"hostname": "newcustomdomain.co.uk",
"port": "80",
"addressesResolved": [
"88.123.123.9"
],
"addressUsed": "66.343.234.9"
}
]
})
Status code 403 tells me that this is unauthorised for some reason.
Question
Despite the approaches tried above, my question is to the SO community is, given the current setup (Forge, Laravel, nginx etc) how would you approach this and any sample code / examples would be greatly appreciated.
I'm using Lumen 5.8.4, Dingo package for making api and I'm trying to use third party package pearl (https://packagist.org/packages/pearl/lumen-request-validate) for form request validation because Lumen doesn't support it.
I've set up everything and validation logic: rules and messages works fine when I define them in class(through postmen I receive "this field is required" etc ), but when everything is fine, when all fields are OK (from frontend side) I got this message
{
"message": "Method App\\Http\\Requests\\StoreVehicleRequest::validate does not exist.",
"status_code": 500,
"debug": {
"line": 102,
"file": "E:\\Damjan\\Programiranje\\PHP\\Laravel\\Lumen\\automoto-lumen\\vendor\\illuminate\\support\\Traits\\Macroable.php",
"class": "BadMethodCallException",
"trace": [
"#0 E:\\Damjan\\Programiranje\\PHP\\Laravel\\Lumen\\automoto-lumen\\vendor\\dingo\\api\\src\\Provider\\LumenServiceProvider.php(58): Illuminate\\Http\\Request->__call('validate', Array)"...
What I see here that trace leads to dingos LumenServiceProvider where i have
$this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) {
$resolved->validate();
});
and I think this one should use pearls RequestServiceProvider, where I have.
$this->app->afterResolving(RequestAbstract::class, function ($resolved) {
$resolved->validateResolved();
});
Or I'm missing something here. Struggling with this whole day. Any ideas?
OK, I've figured out what is going on. RequestServiceProvider is called but after it also Dingo is running LumenServiceProvider witch has an issue with Validator what is shown here
https://github.com/dingo/api/pull/1654/files
So I'm not sure I did the right thing, but this is my solution:
because there is no publishing in Lumen, and I couldn't make it to work with third party packages I've copied LumenServiceProvider in my Provider folder, make a changes, and I've registered it in bootstrap/app.php.
It works for now, hopefully won't make any other problems.
Hi Experts,
I am following https://open.sap.com/courses/s4h13/items/258qEhXx5kdG8b4SXMSJYp tutorial, after deploying the app I am getting 404 for my servlets in approuter application while same servets are giving me 'http 401' in 'address-manager' as expected.
has anyone done this successfully? if so then please guide me in the right direction.
I have gone through everything I could think of, but I can't get past this issue.
xs-app.json file content
{
"welcomeFile": "index.html",
"routes": [
{
"source": "^/api/(.*)",
"target": "/api/$1",
"destination": "app-destination"
},
{
"source": "^/address-manager/(.*)",
"target": "/address-manager/$1",
"destination": "app-destination"
}],
"logout" : {
"logoutEndpoint": "/logout",
"logoutPage": "/logout.html"
}
}
The destinations environment variable of the approuter on SAP Cloud Platform, Cloud Foundry needs to reference the URL(s) at which you reach the application(s) that you want to access via the route(s) defined in the approuter. (Not to be confused with the destinations environment variable that you may be using as a placeholder in athe backend application built with the SAP S/4HANA Cloud SDK.)
In your case, this should probably be some URL pointing to the address-manager, your target application. In the example value mentioned in your comment, you point to the mock server instead, which is probably not what you want.
Change the destinations environment variable to the following and push / restart the application again. (Insert the URL that points to your address manager application deployment.)
[{"name":"app-destination", "url" :"address-manager-<random text>.cfapps.eu10.hana.ondemand.com/", "forwardAuthToken": true}]
The fact that you can login and logout despite the misconfigured destination is expected, because those paths are actually served by the approuter itself.