You don't really have to register all your routes the way you're doing because they can be resolved as only one route. This command was doing nothing, as far as I can tell:
Route::any($url, $route_name);
Because it's not pointing to a controller, it's just pointing to a name tuning.something
, which is nothing to the Laravel router system. So, in fact your whole registerTuningRoutes
function was doing nothing. But you already had a working route, which was doing all the work for:
Route::any('{field}', 'TuningController@TuningMethod');
That being said, looks like you can cut some of your code and just have keep this route:
Route::any('{field}', 'TuningController@TuningMethod');
Your controller method which is already working but would have to change to render the view directly:
<?php
public function TuningMethod($tuning = null)
{
// $tuning will contain the current tuning name, check
$tuning_name = ($tuning);
$tuning_name = strtoupper($tuning_name);
$user = DB::table('guitar_tunings_links')->where('tuning', $tuning_name)->first();
return View::make('home.tuning')->with('user', $user)->with('tuning_name', $tuning_name);
}
The app/views/home/tuning.blade.php
file could be something like:
@extends('layout')
@section('content')
<div>
You HTML here to beautifully render your page.
This is your tunning details:
<div class="panel panel-default">
<div class="panel-heading">$user->name - $tuning_name</div>
<div class="panel-body">
$user->description
</div>
</div>
</div>
@stop
And you should have a app/views/layout.blade.php
file, to wrap it all with a HTML and body tags:
<html>
<body>
@yield('content')
</body>
</html>