installing laravel new project
composer create-project --prefer-dist laravel/laravel newProject
Project running perfect in http://localhost:8000/ in this port
after some time page loading stil
and clear everything in this project i think its cache error
php artisan cache:clear
php artisan config:clear
php artisan view:clear
project running for 2 min then still again loading
then this project change port like
php artisan serve --port 9000
same as working for 2 or 3 min then still loading
i dont know whats problem in this project any idea for this ?
i tried same project on my second system working fine
Route::get('/user', 'YourController#YourControllerFunction')->middleware('auth');
Or if you have many api's that need to use the authentication middleware then create a group like:
Route::group(['middleware' => 'auth'], function () {
Route::get('/user', 'YourController#YourControllerFunction');
});
Also keep in mind that the auth:api middleware requires a token to be generated for user authentication.
Yah i got a answer
its not a php error operating system problem
thats why auto remove server.php file in my project
Its better solution is update your operating system
php artisan serve manually serve project its working fine like php -S localhost:8000 -t path
Related
I have installed Laravel 8 as a new project. When I run the project I get the "In order to use the Auth::routes() method, please install the laravel/ui package." But Laravel installation doc says that laravel ui is depreciated and that we should use Jetstream. So I installed Jetstream with the Livewire stack. Back to test the project and I get the same error msg.
I have run a composer dump-autoload.
What do I have to do to get a Laravel 8 project to run?
You will need to clear and recreate cache. Run the following php artisan commands:
php artisan cache:clear
php artisan config:cache
php artisan route:cache
I had this problem as well on many 'upgrades' from earlier versions of Laravel. I don't want to change the entire auth mechanism, as it works, so I will keep the code I have.
#Elisha Senoo's answer is correct, and solved it most of the time. However, if you find yourself unable to clear the cache (because it has the same error message on the artisan command), the solution is to manually clear the .php files within the bootstrap/cache folder and then php artisan config:cache.
This is consuming the last 2 days of my life. Locally everything is working fine but when my code is deployed to Heroku, Laravel can't find the index view. It's my understanding this is some caching issue, so I have tried most of Artisan's commands to clean the cache:
php artisan config:cache
php artisan route:cache
php artisan view:clear
php artisan clear-compiled
This is my route, I'm serving a SPA:
Route::get('/{any}', 'HomeController#main')->where('any', '.*');
And this is the stack trace on my view:
I have cleaned the bootstrap/cache folder and honestly I'm out of ideas. Does someone have a light on this one? Thanks
Please use the all around cache clearing command :
php artisan optimize:clear
I've found the solution to the same issue:
The issue itself seems to be caused by the official php buildpack, which does php artisan optimize at the end of the build process inside the build environment (aside from other things it clears and recreates the configuration cache). This causes the build directory /tmp/build_xxxxxxxx/ to be saved into the configuration cache.
The solution is to run php artisan config:clear, but it won't take effect on the already built and running app because of how heroku works: when you access their shell you perform operations on the filesystem that's generated from a project build and is destroyed as soon as you exit the shell. The operations you perform on files in that shell don't effect the running app instances. php artisan config:clear must be ran at the end of the build process.
One way to do this is the gerardbalaoro/laravel buildpack which allows adding custom hooks after the build process. Keep in mind that it also does php artisan views:clear after the build while the official php buildpack doesn't. Using it and adding LARAVEL_COMMANDS='php artisan config:clear' to heroku config solved the issue for me.
tl;dr:
heroku buildpacks:set gerardbalaoro/laravel
heroku config:set LARAVEL_COMMANDS='php artisan config:clear'
git commit --allow-empty -m 'force rebuild'
git push heroku master
I've seen answers for this question, but I'm still really confused, because answers say I need to be in my Laravel's project folder, which I thought I had created.
I'm trying to run the command php
php artisan horizon:install
This is the second step in the Laravel installation guide found here: https://laravel.com/docs/7.x/horizon#installation
My directory structure looks like this in my documents folder in Mac OS:
I've tried running the command in the RetimeWeb, vendor, bin, laravel and horizon folders. What am I doing wrong here? Where is an artisan folder supposed to be?
Laravel Horizon is dashboard for managing queues (jobs) in Laravel that supposed to be installed on top of Laravel project.
Based on your directory structure you installed Horizon from composer alone. Now you are trying to run command "php artisan horizon:install" but artisan is a tool from Laravel.
"horizon:install" supposed to copy all assets, configs etc to Laravel project - but again, you do not have any so there is not even where to copy it.
To summary.
Install Laravel.
Install Laravel Horizon.
Do cd until you're in the root folder of your project and run the command again. artisan file is in the root folder of a laravel project
my website run correctly at localhost but when i upload it on CPanel it makes a mistake and say me view index not found
InvalidArgumentException View [index] not found.
this is my Route Code:
Route::get('/', function () {
return view('index');
});
Also i executed these commands:
php artisan config:cache
php artisan config: clear
php artisan view:clear
composer update
php artisan route:clear
but it have no response!!!!!
What's your resources/views directory's permission? It should accessible by your web server.
You should try : php artisan cache:clear
If these commands work:
php artisan config:cache or php artisan
config:clear?
named your view correctly with yourview.blade.php?
placed the view correctly in the resources\views?
Maybe the problem is that your server is not setting up properly because the domain doesnt connected properly to your VPS. Contact the hosting provider.
i solved it, i upload new project and it solved but i don't know what is the issue of last project. It's so weird
I want to make use of auth system which comes with the laravel package but the problem is when I make new laravel package using composer i.e composer create-project laravel/laravel project name --prefer-dist
it do not install those auth resources which includes (i.e. auth folder inside resources > views) and also I can't find the Services Folder inside app directory.
All other things are working fine except this authentication system.
What can be the possible problems? Please give me solution
I am working with MAMP.
Taylor Otwell has made it opt-in for Laravel 5.1
You need to run following command after installation
php artisan scaffold:auth
UPDATE
I think this has been answered here
You could also run the command php artisan make:auth in the root directory of you laravel project. I had the same problem and it worked for me.
The command php artisan scaffold:auth didn't work for me i don't know why.
it issued the error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "auth" is not defined.
Did you mean this?
make:auth
in Laravel 5.2 you just have to run this command "php artisan make:auth" and the auth folder will be created
Since laravel 6.* version make:auth is no longer supported, use ui:auth instead.
For deploying ui pack run
composer require laravel/ui --dev
then update composer.json :
composer update -W
and do the:
php artisan ui:auth
You need execute
php artisan make:auth
now if your style css and js are missing
You need load file .css and .js
1) execute in your project
npm install
2) then execute
npm run dev => now in folder /public now exist folder js and css
3) reload page