Skip to content

Commit

Permalink
fixing all error log merge on dev
Browse files Browse the repository at this point in the history
  • Loading branch information
deaaprizal committed Jul 25, 2022
1 parent 6455a6e commit d5eb43e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
10 changes: 6 additions & 4 deletions app/Http/Controllers/AuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ public function profile($author)

$user = User::where('username', $author)->first();

if ($user == null) { return abort(404); }
if ($user == null) {
return abort(404);
}

$posts = Posts::orderByDesc('id')->where('author', $author)->with('comments')->paginate(10);
return Inertia::render('Author', [
'title' => $author,
'root' => "HOME",
'author' => $user[0]->username,
'author_image' => $user[0]->image,
'is_online' => $user[0]->token ? true : false,
'author' => $user->username,
'author_image' => $user->image,
'is_online' => $user->token ? true : false,
'posts' => $posts
]);
}
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ public function notification()

return Inertia::render('Dashboard/Notification', [
'notifications' => $notifications,
'title' => 'Notification',
'next' => 'Notification',
'title' => 'NOTIFICATION',
'next' => 'DASHBOARD',
'nextRoute' => 'dash.main',
]);
}

public function markNotificationAsRead($id)
{
$notification = Auth::user()->notifications->find($id);
$notification = Auth::user()->notifications->find($id);

$notification->markAsRead();
$notification->markAsRead();
}

public function showSavedPost()
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/Homepage/PostList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default function PostList(props) {
/>
<button
type="button"
className={`btn btn-primary font-bold btn-md w-full rounded-md ${props.user == null || !isValid && 'text-white'}`}
className={`btn dark:text-white btn-primary font-bold btn-md w-full rounded-md ${props.user == null || !isValid && 'text-white'}`}
disabled={props.user == null || !isValid ? true : false}
onClick={() => handlerCommentSubmit()}
>
Expand Down
20 changes: 10 additions & 10 deletions resources/js/Layouts/Authenticated.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ export default function Authenticated({ auth, header, children }) {
</div>

<div className="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<NavLink href={route('dash.main')} active={route().current('dash.main')}>
Dashboard
<NavLink href={route('dash.notif')} active={route().current('dash.notif')}>
Notification
</NavLink>
<NavLink href={route('posts.main')} active={route().current('posts.main')}>
Manage Post
</NavLink>
<NavLink href={route('dash.saved.post')} active={route().current('dash.saved.post')}>
Saved Post
</NavLink>
<NavLink href={route('dash.setting.profile')} active={route().current('dash.setting.profile')}>
Setting
</NavLink>
<NavLink href={route('dash.notif')} active={route().current('dash.notif')}>
Notification
<NavLink href={route('dash.main')} active={route().current('dash.main')}>
Dashboard
</NavLink>
</div>
</div>
Expand Down Expand Up @@ -70,6 +67,9 @@ export default function Authenticated({ auth, header, children }) {
</Dropdown.Trigger>

<Dropdown.Content>
<Dropdown.Link href={route('dash.setting.profile')} active={route().current('dash.setting.profile')} as="button">
Setting
</Dropdown.Link>
<Dropdown.Link href={route('logout')} method="post" as="button">
Log Out
</Dropdown.Link>
Expand Down Expand Up @@ -115,9 +115,6 @@ export default function Authenticated({ auth, header, children }) {
<ResponsiveNavLink href={route('dash.saved.post')} active={route().current('dash.saved.post')}>
Saved Post
</ResponsiveNavLink>
<ResponsiveNavLink href={route('dash.setting.profile')} active={route().current('dash.setting.profile')}>
Setting
</ResponsiveNavLink>
<ResponsiveNavLink href={route('dash.notif')} active={route().current('dash.notif')}>
Notification
</ResponsiveNavLink>
Expand All @@ -134,6 +131,9 @@ export default function Authenticated({ auth, header, children }) {
</div>

<div className="mt-3 space-y-1">
<Dropdown.Link href={route('dash.setting.profile')} active={route().current('dash.setting.profile')} as="button">
Setting
</Dropdown.Link>
<ResponsiveNavLink method="post" href={route('logout')} as="button">
Log Out
</ResponsiveNavLink>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Dashboard/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function NotificationPage(props) {
{/* <div className='flex flex-col justify-center items-center lg:flex-row lg:flex-wrap lg:items-center gap-4'> */}
<div className="flex flex-col justify-center items-center lg:flex-col lg:flex-wrap gap-4">
{(props.notifications.length > 0) ? props.notifications.map((notification, index) => (
<div className="card w-full p-5 md:w-1/2 lg:w-1/3 xl:w-1/3 bg-base-100 shadow-lg">
<div className="card w-full p-5 md:w-1/2 lg:w-1/3 xl:w-1/3 bg-base-100 shadow-lg dark:text-black" key={index}>
{(notification.data.type === 'comment') ? (
<Link onClick={() => markNotificationAsRead(notification.id)} href={route("outer.byId", [notification.data.post_id])}>
<b>{notification.data.commentartor}</b> mengomentari postingan Anda <i> "{notification.data.description}"</i>
Expand Down
12 changes: 8 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,33 @@ function () {

// user dashboard authorized grup

Route::middleware(['auth', 'verified'])->group(function() {
Route::middleware(['auth', 'verified'])->group(function () {
Route::controller(DashboardController::class)->name('dash.')->group(
function () {
Route::get('/dashboard', 'index')->name('main');
Route::get('/dashboard/notif', 'notification')->name('notif');
Route::get('/dashboard/saved-post', 'showSavedPost')->name('saved.post');
Route::get('/dashboard/manage-posts', 'manage_posts')->name('manage.posts');
Route::post('/dashboard/photo', 'update_photo')->name('update.photo')->middleware('isValidUser');
Route::get('/dashboard/setting-profile', 'setting')->name('setting.profile');
Route::put('/dashboard/update-username', 'update_username')->name('update.username')->middleware('isValidUser');
Route::get('/dashboard/mark-notification-as-read/{id}', 'markNotificationAsRead')->name('notif.mark-as-read')->middleware('isValidUser');
Route::get('/dashboard/change-password', 'changePassword')->name('change.password');
Route::put('/dashboard/update-password', 'updatePassword')->name('update.password')->middleware('isValidUser');
Route::post('/dashboard/photo', 'update_photo')->name('update.photo')->middleware('isValidUser');
}
);

//user dashboard posts
Route::controller(PostsController::class)->name('posts.')->group(
function () {
Route::get('/dashboard/manage-posts/posts', 'show')->name('main');
Route::get('/dashboard/manage-posts/posts/create', 'create')->name('create');
Route::post('/dashboard/manage-posts/posts', 'store')->name('store')->middleware('isValidUser');
Route::post('/dashboard/manage-posts/posts/delete', 'destroy')->name('remove')->middleware('isValidUser');
Route::post('/post/comment', 'storeComment')->name('storeComment')->middleware('isValidUser');
Route::post('/post/like/love', 'storeLike')->name('storeLike')->middleware('isValidUser');
Route::post('/post/saved-post/saved', 'storeSavedPosts')->name('storeSavedPosts')->middleware('isValidUser');
}
);

});


Expand Down

0 comments on commit d5eb43e

Please sign in to comment.