How to get new laravel 5.4 folder structure - laravel

I updated my laravel app from 5.2 to 5.3 then 5.4 (To avoid problems with direct update). The update was successful and my app is working fine. But then I can't find changes in the folder structure. A particular change I will like to see is my routes.php file leaving from root/app/Http/ to root/routes/.
I am wondering if this is normal and how I can modify it to take the new structure thanks in advance!

Well, if you update your app, those changes won't be made automatically. In upgrade guide there are only described changes that are necessary to make your application work.
When we are talking about routes, it's not so important, so you can have them as you had before or if you want you can move them and also rename those files (now there is no routes.php file but web.php, api.php and console.php files).
To move routes into new structure you should compare https://github.com/laravel/laravel/blob/5.2/app/Providers/RouteServiceProvider.php with https://github.com/laravel/laravel/blob/master/app/Providers/RouteServiceProvider.php - so you need to update your RouteServiceProvider file and move files into new locations.

Related

Livewire folder structure

I am quite new to Livewire and I feel a little bit confused about its folder structure.
I use the classic Laravel folder structure for my views and I put the components under the /resources/views folder; now with Livewire it seems that I am forced to put my components under /resources/views/livewire folder otherwise the component throws an error.
I also tried to change the view_path in my config/livewire.php file to resource_path('views'), instead of resource_path('views/livewire'), but it doesn't work.
The result is a messy structure like the following, where the users' components are in a different folder and I have to go back and forth to find what I want.
Wouldn't it be possibile to remove the /resources/views/livewire folder and put the components under the relative folder they belong to?
resources
views
users
index.blade.php
livewire
users
table.blade.php
the answer is the config file /config/livewire.php
'view_path' => resource_path('views/livewire'),
Just make sure you update all the Livewire class files views in their render function and that you clear any stale config information
php artisan cache:clear
edit: I have tested this and have regular Laravel blades along side livewire ones.

Laravel version 5.3 removed routes.php

I am new to Laravel and trying to follow some tutorials. Apparently the old routes.php has been removed and another completely different process is in place.
What do I do when a tutorial wants me to make some changes to /app/Http/routes.php? I even created a routes.php file in the path mentioned but it didn't seem to work.
There is now a routes folder. Within is the web.php file. This is the new routes file. You can make all your routes within web.php the same way you did previously in routes.php. More info here: https://laravel.com/docs/5.3/routing

laravel 5 showing directory structure in vps

I have installed Laravel 5 in my vps form the instruction given in the "http://laravel.com/docs/5.1" link. It installed successfully but when I go to http://myipaddress/laravel it showing me the directory structure. I had check my php.ini file also for the "mod_rewrite" and it is showing in the loaded package, so where I am going wrong.
Access the public folder. That's where all your output content goes. http://myipaddress/laraval/public/
Edit:
One other thing. Don't name your project "laravel" as it may cause naming problems. Try to create a new project with a different name.

Codeigniter working directory inside another working directory

Hi I am working on codeigniter for a while now and have met with an issue.
I use "localhost/controller/function" which is how codeigniter works.
Where controller classes are in controller folder in application.
I have a new codeigniter setup in root folder names "big" with its own controller, view, models etc. How can I run files in "big" like I do for my the original application.
I tried "localhost/big/controller/function", which obviously didn't work.
Please help, I am completely new with codeigniter.
just go to index.php of your application (big)
change/add line:
$application_folder = "applications/big";

External PHP Include in Laravel

We run a main website which is not made in Laravel. A specific script on this website however is made in Laravel. We need this script (or to be exact, a specific view inside of it) to fetch some resources from the main website (PHP files which mainly include HTML). When, inside the Laravel application, we try to include these resources, we can not - as they don't exist in the Laravel project workspace. This results in an error that the file does not exist. Attempting to climb out of the project (../../../file.php) does not seem to help either.
We're including it this way:
<?php
include '~/template/nav.php';
?>
We don't wish to include this file into the actual Laravel project, as that would require having to update it twice to ensure they remain equal. Is there any way for us to include this "external" file in our view? Every bit of research done seems to suggest adding it into the project, which would just cause twice the amount of administration on updates.
Cheers!
Just faced same problem. My Laravel Project is an API that need's to include outside php file. So what I did was specify entire path:
include($_SERVER['DOCUMENT_ROOT'].'/../../my_example_file.php');
$_SERVER['DOCUMENT_ROOT'] will lead you to Laravel's public folder.

Resources