openclassify/Modules/Profile/Http/Controllers/ProfileController.php
GitHub Copilot 22fcd68ed0 Rewrite as Laravel 12 classified ads site (OpenClassify)
- Complete rewrite using Laravel 12 framework
- Modular architecture with nwidart/laravel-modules v11
- Modules: Category, Listing, Location, Profile
- 8 top-level categories with 33 subcategories seeded
- 6 sample listings seeded
- 5 countries, 13 cities, districts seeded
- Multi-language support: en, tr, ar, zh, es, fr, de, pt, ru, ja
- Auth scaffolding via Laravel Breeze
- Partner dashboard for user listing management
- Tailwind CSS via CDN for styling
- SQLite database for development
- RTL support for Arabic locale

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-02 23:34:07 +00:00

35 lines
1.0 KiB
PHP

<?php
namespace Modules\Profile\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Modules\Profile\Models\Profile;
class ProfileController extends Controller
{
public function show()
{
$profile = Profile::firstOrCreate(['user_id' => auth()->id()]);
return view('profile::show', compact('profile'));
}
public function edit()
{
$profile = Profile::firstOrCreate(['user_id' => auth()->id()]);
return view('profile::edit', compact('profile'));
}
public function update(Request $request)
{
$data = $request->validate([
'bio' => 'nullable|string|max:500',
'phone' => 'nullable|string|max:20',
'city' => 'nullable|string|max:100',
'country' => 'nullable|string|max:100',
'website' => 'nullable|url',
]);
Profile::updateOrCreate(['user_id' => auth()->id()], $data);
return redirect()->route('profile.show')->with('success', 'Profile updated!');
}
}