File tree 4 files changed +22
-8
lines changed
resources/views/components
4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change
1
+ @props ([
2
+ ' action' => null ,
3
+ ] )
4
+
5
+
1
6
<span class =" inline-flex rounded shadow {{ $attributes -> get (' class' ) } }" >
2
7
@if ($attributes -> has (' href' ) )
3
8
<a {{ $attributes -> except (' class' ) } } class =" w-full bg-white border border-gray-200 rounded py-2 px-4 inline-flex justify-center text-lg leading-6 text-gray-900 hover:bg-gray-100" >
4
9
{{ $slot } }
5
10
</a >
11
+ @elseif ($action )
12
+ <form method =" POST" action =" {{ $action } }" class =" w-full" >
13
+ @csrf
14
+ @method (' POST' )
15
+
16
+ <button type =" submit" {{ $attributes -> except (' class' ) } } class =" w-full bg-white border border-gray-200 rounded py-2 px-4 inline-flex justify-center text-lg leading-6 text-gray-900 hover:bg-gray-100" >
17
+ {{ $slot } }
18
+ </button >
19
+ </form >
6
20
@else
7
21
<button {{ $attributes -> except (' class' ) } } class =" w-full bg-white border border-gray-200 rounded py-2 px-4 inline-flex justify-center text-lg leading-6 text-gray-900 hover:bg-gray-100" >
8
22
{{ $slot } }
9
23
</button >
10
24
@endif
11
- </span >
25
+ </span >
Original file line number Diff line number Diff line change 5
5
<h3 class =" text-xl font-semibold" >Notifications</h3 >
6
6
7
7
@can (App \Policies \ThreadPolicy:: UNSUBSCRIBE , $thread )
8
- <x-buttons .secondary-cta href =" {{ route (' threads.unsubscribe' , $thread -> slug ()) } }" class =" w-full mt-3" >
8
+ <x-buttons .secondary-cta action =" {{ route (' threads.unsubscribe' , $thread -> slug ()) } }" class =" w-full mt-3" >
9
9
<span class =" flex items-center justify-center gap-x-2" >
10
10
<x-heroicon-o-volume-off class =" w-6 h-6" />
11
11
Unsubscribe
16
16
You are currently receiving notifications of updates from this thread.
17
17
</p >
18
18
@elsecan (App \Policies \ThreadPolicy:: SUBSCRIBE , $thread )
19
- <x-buttons .secondary-cta href =" {{ route (' threads.subscribe' , $thread -> slug ()) } }" class =" w-full mt-3" >
19
+ <x-buttons .secondary-cta action =" {{ route (' threads.subscribe' , $thread -> slug ()) } }" class =" w-full mt-3" >
20
20
<span class =" flex items-center justify-center gap-x-2" >
21
21
<x-heroicon-o-volume-up class =" w-6 h-6" />
22
22
Subscribe
28
28
</p >
29
29
@endcan
30
30
</div >
31
- </div >
31
+ </div >
Original file line number Diff line number Diff line change 86
86
Route::delete ('{thread} ' , [ThreadsController::class, 'delete ' ])->name ('threads.delete ' );
87
87
Route::put ('{thread}/mark-solution/{reply} ' , [ThreadsController::class, 'markSolution ' ])->name ('threads.solution.mark ' );
88
88
Route::put ('{thread}/unmark-solution ' , [ThreadsController::class, 'unmarkSolution ' ])->name ('threads.solution.unmark ' );
89
- Route::get ('{thread}/subscribe ' , [ThreadsController::class, 'subscribe ' ])->name ('threads.subscribe ' );
90
- Route::get ('{thread}/unsubscribe ' , [ThreadsController::class, 'unsubscribe ' ])->name ('threads.unsubscribe ' );
89
+ Route::post ('{thread}/subscribe ' , [ThreadsController::class, 'subscribe ' ])->name ('threads.subscribe ' );
90
+ Route::post ('{thread}/unsubscribe ' , [ThreadsController::class, 'unsubscribe ' ])->name ('threads.unsubscribe ' );
91
91
92
92
Route::get ('tags/{tag} ' , [TagsController::class, 'show ' ])->name ('forum.tag ' );
93
93
});
Original file line number Diff line number Diff line change 74
74
$ this ->login ();
75
75
76
76
$ this ->visit ("/forum/ $ slug " )
77
- ->click ('Subscribe ' )
77
+ ->press ('Subscribe ' )
78
78
->seePageIs ("/forum/ $ slug " )
79
79
->see ("You're now subscribed to this thread. " );
80
80
});
87
87
$ this ->loginAs ($ user );
88
88
89
89
$ this ->visit ("/forum/ $ slug " )
90
- ->click ('Unsubscribe ' )
90
+ ->press ('Unsubscribe ' )
91
91
->seePageIs ("/forum/ $ slug " )
92
92
->see ("You're now unsubscribed from this thread. " );
93
93
});
You can’t perform that action at this time.
0 commit comments