feat: complete comment history
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Account;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CommentHistoryController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$comments = Comment::where('user_id', auth()->id())
|
||||
->with(['tour', 'flight'])
|
||||
->latest()
|
||||
->paginate(10);
|
||||
return view('account.comment-history', compact('comments'));
|
||||
}
|
||||
}
|
||||
@@ -76,10 +76,15 @@ class RegisterPostRequest extends FormRequest
|
||||
'unique:App\Models\User',
|
||||
'ir_mobile:zero'
|
||||
],
|
||||
'password' => [
|
||||
'current_password' => [
|
||||
'required',
|
||||
'current_password',
|
||||
],
|
||||
|
||||
'new_password' => [
|
||||
'required',
|
||||
'min:6',
|
||||
'confirmed'
|
||||
'confirmed',
|
||||
],
|
||||
'province_id' => [
|
||||
'nullable',
|
||||
|
||||
@@ -105,4 +105,9 @@ class User extends Authenticated
|
||||
{
|
||||
return $this->hasMany(Comment::class);
|
||||
}
|
||||
|
||||
public function wishlists()
|
||||
{
|
||||
return $this->hasMany(Wishlist::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,3 +8,21 @@ if (!function_exists('getUserFullName')) {
|
||||
return $user->first_name . ' ' . $user->last_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getFileUrl')) {
|
||||
|
||||
function getFileUrl(?int $fileId): ?string
|
||||
{
|
||||
if (!$fileId){
|
||||
return null;
|
||||
}
|
||||
|
||||
$file = \App\Models\File::find($fileId);
|
||||
|
||||
if (!$file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return asset('storage/' . $file->path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user