1

A project, which is prepared with Laravel Framework, has handed over to me. Previous developer has not used git, some composer commands and Laravel's .gitignore file(also removed it). On the other hand he has prepared the project on the production server.

Anyway. Firstly I've found a gitignore for laravel and pushed the project to my repository. Then I wanted to pull it to my local. All folders and files pulled except of vendor folder.

Then I executed:

composer install

Gave me this error:

Class 'Maatwebsite\Excel\Excel' not found

Then I fixed it by the method here.

Then retried composer install, gave me this error:

Undefined index: name

Then fixed it by the method here.

Then retried composer install, and succeeded. Then I cleared cache with php artisan cache:clear

I've configured .env file and tried to enter to homepage. It redirected me to login page and gave 404. I've checked the .htaccess, there was redirection like that:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
    
    RewriteCond %{SERVER_PORT} 443
    RewriteRule ^(.*)$ http://example.com/app/$1 [R=301,L]
    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


# php -- BEGIN cPanel-generated handler, do not edit
<IfModule mime_module>
  AddType application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Changed the example.com to my localhost. But still gives me 404.

Is there anything that I'm missing?

Note: Called the previous developer, and he said me "directly copy and paste the all folders". Hi from 90s :(

sundowatch
  • 3,012
  • 3
  • 38
  • 66
  • Silly question but did you copy over the routes? –  Mar 18 '21 at 17:22
  • @AMR what do you mean by "copy over the routes". I haven't copied anything. Just git push and pull – sundowatch Mar 18 '21 at 17:29
  • okay let's go over what *should* be there for the pages to return correctly: First you need a routes folder with with all the routes in files inside of it. Second you need the Controller folder (found in /app/Http). Third you need the resources folder with the actual views. Fourth you need the public folder with the CSS/JS, etc. If the routes are missing or the controller is missing you'll get an error page. Could you confirm that all of these exist? –  Mar 18 '21 at 17:33
  • I think you have a good point. My other views works well, but not login page – sundowatch Mar 18 '21 at 20:07
  • The previous dev, has changed the login router as loginhtdedwqa, so it can not find it – sundowatch Mar 18 '21 at 20:15
  • @AMR please write your suggestion with mine as answer – sundowatch Mar 18 '21 at 20:27
  • find out what the login view page is called, then go to your routes and make sure there's a line such as "Route::get('/login', 'SomeController@somefunction')->name('login.path');" Then go to the controller that is referenced in that route, and make sure that the function returns the view of the login page –  Mar 18 '21 at 21:20
  • 1
    ok, worked. Please write it as answer, so I can assign this question as solved – sundowatch Mar 18 '21 at 21:28

3 Answers3

1

OP Said this worked for him so I'm moving it from comments to an answer:

Let's go over what should be there for the pages to return correctly: First you need a routes folder with with all the routes in files inside of it. Second you need the Controller folder (found in /app/Http). Third you need the resources folder with the actual views. Fourth you need the public folder with the CSS/JS, etc.


Since OP stated that all the views work except for the login view:

First find out what the login view page is called, then go to your routes and make sure there's a line such as

Route::get('/login', 'SomeController@somefunction')->name('login.path');

Then go to the controller that is referenced in that route, and make sure that the function returns the view of the login page

0

Have you tried to generate you laravel application key using php artisan key:generate.

If that also doesn't work then try to remove .htaccess temporary.

Maulik Shah
  • 1,040
  • 1
  • 7
  • 17
0

Try this command

composer require maatwebsite/excel:^3.0
Sfili_81
  • 2,377
  • 8
  • 27
  • 36
Switi
  • 359
  • 3
  • 6
  • run composer update and composer dump-autoload in server terminal. – Switi Mar 18 '21 at 17:48
  • config/app.php 'providers' => [ Maatwebsite\Excel\ExcelServiceProvider::class, ], 'aliases' => [ 'Excel' => Maatwebsite\Excel\Facades\Excel::class, ] Add the ServiceProvider and Facade – Switi Mar 18 '21 at 17:54