I'm trying to develope a program with Laravel, I have a problem with a Route, it shows me that is not define but it's already defined, also, I'm using Ajax.
This is the Error
This is my Ajax with URL and Route
And I tried to put the Route in that part of the code, but when I put there I get other problem.
I have tried this
Thank so much for your help.
After adding new route you need to clear cache. So run this commands:
php artisan cache:clear
php artisan route:cache
And check again
You have same controller method two time define and you did changed only route name? so it can return error. remove first route then it will work fine.
Route::post('schedule/destory', 'Client\SchedulesController#destory')->name('client.schedules.destory');
Route::post('schedule/destory', 'Client\SchedulesController#destory')->name('orders.schedules.store');
please remove Route::post('schedule/destory', 'Client\SchedulesController#destory')->name('client.schedules.destory'); route.
Related
I'm using Laradock with Laravel 7.24, and I can't make a Blade template component work.
I've followed the tutorial from the official documentation page, so, inside the docker-machine executed:
php artisan make:component Alert
And placed the component inside of the layout blade template:
<x-alert/>
But it throws the following error:
Target class [Illuminate\Support\Facades\App\View\Components\Alert]
does not exist. (View: /var/www/resources/views/layouts/app.blade.php)
Does anyone know what is the issue?
Thanks!
Experienced with the same problem.
First of all, remove the file from app/view/components this path and run
php artisan view:clear this command.
Hope it will work.
To use the component anonymous you need to delete class app/View/Components/Alert.php, deleting the view folder worked for me.
I Blog in Laravel v5.6
when translate new route it doesn't work for me
but old route like login and register and landing pages it working as well when i going in new route it's not
Switch Lang page
Route::get('locale/{locale}', function ($locale) {
Session::put('locale', $locale);
return redirect()->back();
// this link will add session of language when they click to change langauge
})->name('locale');
Route::get('/{username}', 'ProfileAccountController#index')->name('profile')->middleware('admin.user');
when i going to this route it's not working and navbar and footer it's back to key, remove all code in this page and test the lang it's not work too.
I use all of this command and nothing
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan clear-compiled
Thank you.
My suggestions:
Use middle-wear for changing languages and use https://github.com/spatie/laravel-translatable like this for more comfortable usage.
Also check this Change language in Laravel 5 might help you.
Had similar issues with Route closures. Try moving you're session setters/getters to a Controller and not within a Route closure.
https://laravel.com/docs/5.7/session#using-the-session
This will probably solve your issues.
I have been encountering a weird problem with Laravel over the last week.
Basically, lets say for example that I am editing a view, "view.blade.php", and the controller, "ViewController.php", and I am constantly refreshing the browser page to see my changes.
My view is loaded by the index() function of my ViewController like so:
public function index()
{
return view('view');
}
Everything is working and I am seeing my changes reflected in the browser. However, all of a sudden for some reason, the page goes white and my view stops loading. No error in Laravel.log or console, nothing. It just shows a white page.
The thing is, if I change the name of my view file to "view2.blade.php" and change my index function to return 'view2' instead, the page loads as normal and works perfectly. It seems that the file name is the only thing keeping the page from loading.
I have tried clearing all the caches with the following artisan commands:
php artisan route:cache
php artisan cache:clear
php artisan view:clear
php artisan config:cache
and executing php artisan optimize
However, the problem still persists. I have not modified or added any vendor files.
This doesn't happen too often but it is annoying and it normally "magically" solves itself when I leave it alone for a while to work on another view/controller. However, I just want to know if anyone else has this problem and if there is a solution anywhere.
I defined my route like so:
Route::resource('view', 'ViewController');
Using Laravel 5.4
try to clear browser cash ctrl + F5
Hey try this url http://yoursite.dev/view/, do note you need to replace the yoursite.dev with your local domain.
By including the 'view' string in the resource function you are making a restful resource relative to the /view base domain.
Here is a link to the docs https://laravel.com/docs/5.4/controllers#resource-controllers
reference the table Actions Handled By Resource Controller for a thorough explanation.
No matter what I try, the route /authenticate/{code} returns a NotFoundHttpException.
My route in routes.php:
Route::get('/authenticate/{code}', ['as' => 'authenticate', 'uses' => 'FrontendController#getAuthenticate']);
When I am calling the route:
URL::route('authenticate', $code)
On my local machine it runs it just fine, but on my production server, it takes me to a NotFoundHttpException page.
It does site inside of the web middleware group.
I have tried (with no success):
resetting the github repo on the server (fresh install)
composer update
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
composer dump-autoload
changing the route from authenticate to authenticate-email
What could it be? Every other route on the site works, it is just this one that doesnt.
The only thing I can think to advise is switching from using the URL Facade to using the built in helper function $url = route('authenticate', ['code' => $code]); I only say this because I can't seem to find in the docs how you hint at URI parameters when using URL::route() :)
I also ran into this issue. I deleted the route, then copy another working route and changed the route name and parameters with the one. And It Worked
I don't know if you solved this but I just had exactly the same problem, nothing I did would make the route work. It was a really simple route: Route::get('/search', ['middleware' => 'shop_session','uses' => 'Cinder\StoreController#viewProducts']);
Did all the things you did. In the end I moved the route to the top of my routes file, ran php artisan route:cache and it worked.
Not a great answer and I've got no idea why it worked but it did. Maybe worth a try?
First of all I have just begun to tinker with Laravel 5 and php artisan, so don't judge to harsh please ;)
To get rid of ./public/index.php in the website path I did the following:
moved all the files in root/page_local/ folder;
moved files from public folder to root/page/;
modified the root/page_local/index.php file accordingly.
So the laravel works as it should now, but php-artisan is not. Every command that I try to run returns the same error:
[BadMethodCallException]
Method patter does not exist.
But I remember creating a Controller before and it worked, I tried multiple functions (--version, list, create::controller).
Even when I run composer update it errors when it tries to run php artisan clear-compiled.
I still managed to update the composer by running composer update --no-scripts
Please help me out on this one because I couldn't find any information regarding this issue on Laravel website and google. If you will need me to provide any of my code, let me know what you need and I will do so.
Thanks in advance.
Search your code for patter string, my guess is that you have a typo somewhere and the method is called pattern so use that instead. There is no patter method anywhere in Laravel code.