Laravel application will not route properly - laravel

I am trying to create a first application using TCPDF and Laravel 8. I have an initial page which has a listing of users from a MySQL table and two buttons (Download PDF and View PDF)
There are three routes setup in my web.php file:
Route::get('/', 'App\Http\Controllers\UserController#index');
Route::get('download', 'App\Http\Controllers\PDFTestController#savePDF')->name('download');
Route::get('viewpdf', 'App\Http\Controllers\PDFTestController#openPDF')->name('viewpdf');
I have tried creating the buttons and their actions several different ways but the result is always the same:
// The download button
<button type="button" onclick="window.location='{{ route("download")}}'" class="btn btn-success btn-sm">Download PDF</button>
// The view button
Open PDF
The route for the home page correctly calls App\Http\Controllers\UserController#index and the expected page is displayed.
However, when I try the download page all I get is a 404 "The requested URL was not found on this server." and the URL it is trying is .../LaravelPDF/public/download
Clicking the View button results in a 404 as well and the URL is /LaravelPDF/public/viewpdf
I put some DD() calls in the various functions and it does not appear that they are ever being called. Instead Laravel is trying to open a view named download or viewpdf.
I even tried creating a download.blade.php file but that does not open either.
What am I doing wrong? Thank you in advance for your help.

Just Run your terminal
php artisan route:clear

Related

Shopfiy custom app links are not working inside shopify iframe kyon147/laravel-shopify package

I am using kyon147/laravel-shopify package which is extending from osiset user. The app was already built on another laravel-shopify package that is abandoned now. I have upgraded the package. I fixed all the reported issues.
The problem I am facing is whenever I click on any of the link of the app that is hosted locally. None of the links work. The screen keeps flashing. When I click on the sidebar of shopify all the links work fine.
I have checked X-frame-options' is also set to false using grep -r 'X-Frame-Options'I tried to Log the session data. The array is empty in that even on homepage but after I use dd inHomeController`. It returns few values. I have cross-checked log file. The network tab has returns success code 302 for app bridge which means there is no problem as it is only redirecting. Only working links are those, which are not embedded in shopify app. The link
<a class="Polaris-Breadcrumbs__Breadcrumb" href="{{url('/home')}}" data-polaris-unstyled="true">
is not working. But the following link working
<a class="btn btn-lg btn-success" href="https://wyday.com/limelm/signup/" target="_blank" role="button">Sign up on LimeLm</a>
The only difference I found in the Network tab is how the embedded and non-embedding links are redirecting. Following is a non-embedded link
Following embedded this also include the flashing screen
I have added all my links to allowed redirects as well.

laravel custom pagination problem. the ?page=1 appending to base url not to current url

the ?page=1 appending to base url not to current url
css is not perfectly loading, I mean prev/next and page number buttons are not perfectly loading
the ?page=1 appending to base url not to current url
css is not perfectly loading, I mean prev/next and page number buttons are not perfectly loading
First, you are going to use the Laravel custom pagination template. So run bellow command:
php artisan vendor:publish --tag=laravel-pagination
After running the above command, it will get new folder pagination on views files(resources/views/vendor/). And pagination folder by default following copy in \vendor\laravel\framework\src\Illuminate\Pagination\resources\views the folder:
resources\views\vendor\pagination\
bootstrap-4.blade.php
default.blade.php
semantic-ui.blade.php
simple-bootstrap-4.blade.php
simple-default.blade.php
simple-tailwind.blade.php
tailwind.blade.php
Then in your blade file add the following code:
{{ $someVariable->links('vendor.pagination.custom') }}
I hope this will solve your problem.

How to redirect to a blade dashboard page from Vue login Component page after successfully login in laravel JetStream?

I created a laravel 8 project using jetstream authentication. As stack I have used inertia+vue. After successful login, I need to redirect to a blade file. But the problem is when I redirect to the blade file, the blade file opens as a modal like the image attached below. And the URL doesn't change (I mean the browser doesn't get refreshed). I would be grateful if you can suggest me the solution. Thanks in advance.
I eventually found this that allowed me to redirect to a page directly from a controller without it appearing in a modal—https://inertiajs.com/redirects#external-redirects.
Example:
return Inertia::location($url);

Links and Route not working

I am facing route problem I am using laravel 5.4 and xampp.
I use this address 'localhost/project/laravel/public' to go to home page.
When I click on any link in navigation region, I get object not found.
After clicking, address shows http://localhost/about
I edit home.blade.php as
href = "./" and "./about" By adding period
problem solved to some extent
but when I am on another page
e.g login page address is http://localhost/project/laravel/public/users/login
and if I want to go to contact page, again object not found message received
This time address is http://localhost/project/laravel/public/users/contact
I also tried href="{{ url('/contact')}}" in home.blade.php
The problem remains same.
and
php artisan serve
localhost:8000 gives 'unable to connect'
Please guide, thanks.
What you're doing is wrong, you aren't suppose to navigate to your project's public folder via the browser url... You just need to go to your laravel project folder and run Command prompt and type "php artisan serve". it will generate a url for you. entering that url on your browser will load your project properly and that way all links will work.

load view inside view in codeigniter

Actually m using ahref with onclick function inside my view
<a href="<? echo base_url();?>index.php/manager/engineer" onclick=window.open("<? echo base_url();?>index.php/manager/engineer") >
it is redirecting to url correctly
http://localhost:8888/CI/index.php/manager/engineer
but in that page m getting error as
The page you requested was not found.
even though i have created engineers view file
Anyone helping me to find the solution will be needfull
the CI router just run external links of controller classes and you can't load views externally. instead on you can load views internally on your controllers and now open the controller address via your browsers.
see more : http://ellislab.com/codeigniter/user-guide/general/views.html

Resources