Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chechogrom's avatar

View [admin.users.index] not found. in local it works for me, but in the server of heroku not

Hello everyone, I just deployed an app of laravel 5.5 in heroku, I have these routes registered in web.php


<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// Registration Routes...
// Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
// Route::post('register', 'Auth\RegisterController@register');

// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/administrador', function() {
  return view('admin.dashboard');
})->middleware('auth');

Route::group([
  'prefix' => 'admin',
  'middleware' => 'auth'],
function(){
  Route::resource('users', 'UserController');
  Route::resource('cuadres', 'CuadreController');
  Route::resource('pagos', 'PagoController');
  Route::resource('datafonos', 'DatafonoController');
});

for admin routes I have an admin prefix like in the views folder I have a folder named "admin" admin> users> index.blade.php

locally all this works for me, example app.test/admin/users works

but when I do the same thing on the server it gives me this error ##View [admin.users.index] not found.

this is my controller for users

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
      $users = User::all();
      return view('admin.users.index', compact('users'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
      return view('admin.users.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
      User::create($request->all());

      return redirect()->route('users.index')->with('info','Se ha creado el usuario con éxito');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function show(User $user)
    {
      return view('admin.users.show', compact('user'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function edit(User $user)
    {
      return view('admin.users.edit', compact('user'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, User $user)
    {
      $user->update($request->all());
      return redirect()->route('users.index')->with('info', 'Se ha editado el usuario con éxito');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
    public function destroy(User $user)
    {
      if($user->id === auth()->user()->id){
        return back()->with('error', 'No te puedes eliminar a ti mismo');
      }

      $user->delete();
      return back()->with('info', 'Se ha eliminado el usuario con éxito');
    }
}

thanks in advance, I remain attentive

0 likes
8 replies
neeonline's avatar

Make sure the template exists in production. views/admin/users/index.blade.php

Also run php artisan route:list to double check. Also re-create the cached files in production php artisan cache:clear and re-run the caches.

Best,

chechogrom's avatar

I made sure that the routes were fine from heroku in the console, but I know how to make sure that the file exists, how can I do it, the deployment is done from git I suppose the file does exist?

Nash's avatar

Are you developing on a Windows machine? Make sure your directories and file for that view are named exactly like in your controller (currently all lowercase). Linux filesystem is case-sensitive, Windows is not.

chechogrom's avatar

I'm working on windows with homestead which is an ubuntu machine and locally it works for me, but when I do git push heroku master and the deployment is done, all the routes work except the resource routes

jlrdw's avatar

but I know how to make sure that the file exists

Look.

chechogrom's avatar

I'm wrong, I do not know how to know if the file exists, I'm using google translate

Snapey's avatar

The problem is with the view not with routes.

Check the name of the folders and files in the resources/views folder

Please or to participate in this conversation.