I installed Laravel locally on MAMP and navigated to the correct localhost location, and for some reason am getting Whoops, looks like something went wrong.
The route.php looks fine:
Route::get('/', function()
{
return View::make('hello');
});
Here is the error I'm getting:
base64_decode() expects parameter 1 to be string, array given
Apparently it's caused by this (arrow) in /bootstrap/compiled.php:
protected function getJsonPayload($payload)
{
----> $payload = json_decode(base64_decode($payload), true);
if (!$payload || $this->invalidPayload($payload)) {
throw new DecryptException('Invalid data.');
What am I missing in my new install to make this work?
You should give write permissions (777) to app/storage folder, also try to define debug as true in app/config/app.php to check what is going on.
You try -> go to url you want-> in here you clear cookie.
if chrome: F12 -> Resources -> Clear Cookies here.
Related
Laravel V 8 Jetstream.
This problem appeared with me after I uploaded and published the project on shared hosting
Error message
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods:
HEAD.
enter image description here
Route::get('/', function () {
return view('welcome');
});
route code
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
Route::get('/dashboard',function () {
return view('dashboard');
})->name('dashboard');;
Route::get('/upload', function () {
return view('uploadpdf');
})->name('upload');
});
If you encounter this problem, always check the settings in your .env and config files
The error was found in config.php - /bootstrap/cache/config.php.
I did not configure the location settings like APP_URL and the paths of some directories were pointing to my computer
Good luck everyone
Greetings from the Dzsecurity company team for helping to find a solution
am creating route in laravel-8 only one route is working and the others are not why
Routes problem
Route::get('/', function () {
return view('dashboard');
});
only the '/' the first route working and the other 2 which are below are not working. when want to access on teh screen shows that
404 NOT FOUND.
please some one help me.
Route::get('/allProducts', function() {
return "view('products');";
});
Route::get('contact',function(){
return "hello ";
});
First of all, make sure your URL is correct. According to Laravel 8 documents, you have to display it this way. If this problem persists, check your web server configuration.
Route::get('/allProducts', function () {
return view('dashboard');
});
To see which routes are set up run the following form command line.
php artisan route:list
start a development server by running the following in your command line
localhost:8000/allProducts
I would appreciate any help you could give me with the following problem I have.
I am trying to implement a Single Page Application (SPA) with Laravel and Vue, at the moment I am defining the routes, I have something like the following:
routes/app.php
Route::group(['middleware' => 'web'], function () {
Route::any('{path}', function () {
return view('index');
});
});
What I'm trying to do here is the following:
For the middleware web you will only have one view available, in this case in the file index in (resources/views/index.php)
I want that regardless of the method used, Laravel returns the view I want. But I have not succeeded.
Output of php artisan route:list
And when I try to verify with Postman I receive a 404 in response regardless of the method or the URL that I requested .. what could I be doing wrong? Thank you very much in advance.
EDIT 1
I have modified my router and added a conditional as follows:
Route::group(['middleware' => 'web'], function () {
Route::any('{path}', function () {
return view('index');
})->where('path', '.*');
});
Now the GET and HEAD method work properly, however ... when I try the POST method, I get the following error ..
EDIT 2
As mentioned #lagbox in the comments below, error 419 refers to missing CSRF token. I could disable this check in the file Middleware/VerifyCsrfToken.php.
However I wish I could just return the desired view .. without first checking the CSRF token. Another detail that I find is the following:
When in Postman I make a request by a method different from the typical methods ... let's say UNLINK method, I get the following result:
Which leaves me a bit confused, when I define in my routes file web.php Route::any, does it mean any route or not?
So currently in my Laravel app I've got the route;
Route::get('/{any}', 'SinglePageController#index')->where('any', '.*');
And in this state, it works. However I want to add a prefix to it such as /app/{any} and for it to be inclusive of app as well. So /app would still go to SinglePageController.
I've tried doing something like that and it works for everything except the /app route itself.
Hopefully someone can provide some suggestions.
Try this:
Route::group(["prefix" => "app"], function(){
Route::get('/{any?}', 'SinglePageController#index');
}
I converted the any parameter to optional, so it can go to SinglePageController#index when it's not given too.
Also you may define the parameter of the index method as optional too. Like:
public function index($any = null){
So I am a new Laravel user,I just went straight to the documentation to get started.but I get a question:
In app/routes.php,I write like this:
Route::get('users',function() {
return 'hello';
});
Route::get('/',function() {
return View::make('hello');
});
When I hit
127.0.0.1/aerial/public/
it works fine;When hit:
127.0.0.1/aerial/public/index.php/users or 127.0.0.1/aerial/public/users or localhost/aerial/public/index.php/users
it returns 404;My environment nginx.
You should probably convert your .htaccess file in public directory to nginx format and make sure you have mod rewrite (or nginx module used for that) enabled