- replaced `alert-error` and `alert-success` components with a single reusable `alert` component - added JS functionality for dismissible alerts - updated related views to use the new `alert` component - adjusted broker profile logic to display initials and verification status dynamically - refactored morph relations from `type` to `role` - enhanced image preview behavior for file inputs - made broker migration fields nullable and added safeguards against registration errors - Added confirmation when a user wants delete deal - Add dynamic initials for user profile picture - make image file name non-overidding with timestamp
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Broker;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Broker;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Str;
|
|
|
|
class BrokerProfileController extends Controller
|
|
{
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(User $profile)
|
|
{
|
|
// Get the broker profile
|
|
$broker = $profile->type;
|
|
|
|
// TODO: move this to middleware
|
|
if (! $broker instanceof Broker) {
|
|
abort(403, 'This user is not a broker.');
|
|
}
|
|
|
|
/**
|
|
* Create the initials from a full name (e.g. John Doe, Alex Mark, jane clerk)
|
|
* to display on profile page (e.g. JD, AM, JC).
|
|
*/
|
|
$initials = Str::of($profile->name)
|
|
->explode(' ')
|
|
->map(fn ($word) => Str::substr(ucfirst($word), 0, 1))
|
|
->join('');
|
|
|
|
return view('dashboards.broker.profile.show')
|
|
->with('name', $profile->name)
|
|
->with('joinDate', $profile->created_at->format('F Y'))
|
|
->with('email', $profile->email)
|
|
->with('initials', $initials)
|
|
->with('verified', $broker->verified)
|
|
->with('location', $broker->location)
|
|
->with('phone', $broker->phone);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
//
|
|
}
|
|
}
|