@ -2,6 +2,7 @@
namespace App\Http\Controllers;
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\DB;
use App\Models\Location;
use App\Models\Location;
@ -13,7 +14,6 @@ class FrontIndexController extends Controller
{
{
$locations = Location::where("active", true)->get();
$locations = Location::where("active", true)->get();
$count = count($locations);
$count = count($locations);
$terms = "no|agenda";
$recent = Location::where("active", true)
$recent = Location::where("active", true)
->limit(5)->orderByDesc('updated_at')->get();
->limit(5)->orderByDesc('updated_at')->get();
@ -26,6 +26,27 @@ class FrontIndexController extends Controller
]);
]);
}
}
public function indexSearch(Request $request)
{
$terms = $request->index_search;
$rawSearch = $terms;
$terms = str_replace(",", "", $terms);
$terms = str_replace(" ", "|", $terms);
$results = DB::select("SELECT * FROM searchlocations('$terms')");
$locations = Location::where("active", true)->get();
$count = count($locations);
$recent = Location::where("active", true)
->limit(5)->orderByDesc('updated_at')->get();
return view('front.index', [
'count' => $count,
'recent' => $recent,
'title' => "The Bad Space",
'results' => $results
]);
}
public function about()
public function about()
{
{
return view('front.about', [
return view('front.about', [
@ -41,7 +62,7 @@ class FrontIndexController extends Controller
$name = $location->name;
$name = $location->name;
}
}
return view('front.location', [
return view('front.location', [
'title' => $name,
'title' => str_replace(".", " ", $name) ,
'location' => $location,
'location' => $location,
'images' => json_decode($location->images),
'images' => json_decode($location->images),
'updated' => $location->updated_at->format('Y M d'),
'updated' => $location->updated_at->format('Y M d'),