Search code examples
phpnode.jslaraveladminlte

XAMPP + Laravel + AdminLTE


Alright, so I got super excited when I found the Admin Dash Laravel template which ports the entire AdminLTE template over to Laravel 5.4, including sample pages, db tables, etc., just to hit a roadblock when trying to run this on my local XAMPP Server...

I followed the instructions and:

  • created a new Laravel project via laravel new test3 in Z:/xampp/htdocs/
  • downloaded the Admin-Dash files and pasted them into the new project folder (test3)
  • ran php artisan migration
  • ran npm install
  • edited my .env file to point to the correct folder APP_URL=http://localhost/test3.

which resulted in this: enter image description here

None of the supposedly provided sites such as /login/ or /register/ nor the CSS / JS features seem to work, most likely due to the template looking for the dist folder in http://localhost/dist/ while they are actually located in Z:/xampp/htdocs/test3/public/dist.

How can I change the folder destination in the template? Appreciate any help on that, thank you! A2k

EDIT

As pointed out earlier, there is a problem with the css/js folder location. I have since located the blades for Admin/Guest/Common in Z:\xampp\htdocs\test3\resources\views\layouts and adjusted them as following:

eg. jQuery

<!-- jQuery 2.2.3 -->
<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>

to
<!-- jQuery 2.2.3 -->
<script src="/test3/public/plugins/jQuery/jquery-2.2.3.min.js"></script>

This seems to finally fix the layout issue, but when clicking on any link such as eg. /register/ it points me to http://localhost/register/ instead of http://localhost/test3/register/. It shouldnt be necessary to mess around with the master blade configuration which makes me wonder if there is a master setting for the Admin-Dash path that I am missing?

EDIT 2

Since the CSS/JS issue was fixed by utilizing {{ asset }}, the only problem left are the routes. Right now, when navigating to eg http://localhost/test3/register/ I receive a 404 error, suggesting problems with either the APP URL or routes. Both below:

localhost/test3/routes/web.php

// Registration routes
Route::get('register', 'Auth\AuthController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\AuthController@register');

localhost/test3/config/app.php

'url' => env('APP_URL', 'http://localhost/test4'),

Latest screenshot of the console: enter image description here


Solution

  • First, remove the /test3 from your src="/test3/public/plugins/jQuery/jquery-2.2.3.min.js". Then, define css/js path like: {{ asset('plugins/jQuery/jquery-2.2.3.min.js') }}.

    Be sure that you have jquery-2.2.3.min.js in plugins/jQuery/ directory!

    Make changes in config/app.php like url' => env('APP_URL', 'http://localhost/test4'),

    Use project by creating virtualhost easily and also for implementing and redirection!

    Hope this steps may fixed you problem! :)