init commit
This commit is contained in:
99
app/Http/Controllers/HomeController.php
Normal file
99
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the homepage.
|
||||
*/
|
||||
public function index(): View|RedirectResponse
|
||||
{
|
||||
// If user is authenticated, redirect to dashboard
|
||||
if (Auth::check()) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
// If not authenticated, redirect to login
|
||||
return redirect()->route('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the features page.
|
||||
*/
|
||||
public function features(): View
|
||||
{
|
||||
return view('home.features');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the pricing page.
|
||||
*/
|
||||
public function pricing(): View
|
||||
{
|
||||
return view('home.pricing');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the help page.
|
||||
*/
|
||||
public function help(): View
|
||||
{
|
||||
return view('home.help');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the contact page.
|
||||
*/
|
||||
public function contact(): View
|
||||
{
|
||||
return view('home.contact');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle contact form submission.
|
||||
*/
|
||||
public function submitContact(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'required|email|max:255',
|
||||
'subject' => 'required|string|max:255',
|
||||
'message' => 'required|string',
|
||||
]);
|
||||
|
||||
// Handle contact form logic here
|
||||
// You can send email, save to database, etc.
|
||||
|
||||
return redirect()->route('contact')->with('success', 'Your message has been sent successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the privacy policy page.
|
||||
*/
|
||||
public function privacy(): View
|
||||
{
|
||||
return view('home.privacy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the terms of service page.
|
||||
*/
|
||||
public function terms(): View
|
||||
{
|
||||
return view('home.terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the support page.
|
||||
*/
|
||||
public function support(): View
|
||||
{
|
||||
return view('home.support');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user