mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 12:09:02 -05:00
(Update) Gallery System
- ability for user to delete there own album assuming its within 24 hours of creation date.
This commit is contained in:
@@ -16,6 +16,7 @@ use Illuminate\Http\Request;
|
||||
use App\Services\Clients\OmdbClient;
|
||||
use App\Album;
|
||||
use Image;
|
||||
use Carbon\Carbon;
|
||||
use \Toastr;
|
||||
|
||||
class AlbumController extends Controller
|
||||
@@ -127,8 +128,9 @@ class AlbumController extends Controller
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
if (auth()->user()->group->is_modo) {
|
||||
$album = Album::findOrFail($id);
|
||||
$album = Album::findOrFail($id);
|
||||
|
||||
if (auth()->user()->group->is_modo || (auth()->user()->id == $album->user_id && Carbon::now()->lt($album->created_at->addDay()))) {
|
||||
$album->delete();
|
||||
|
||||
return redirect()->route('home')
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<a href="{{ route('add_image', ['id' => $album->id]) }}">
|
||||
<button type="button" class="btn btn-success btn-md">Add New Image to Album</button>
|
||||
</a>
|
||||
@if(auth()->user()->group->is_modo)
|
||||
@if(auth()->user()->group->is_modo || auth()->user()->id == $album->user_id && Carbon\Carbon::now()->lt($album->created_at->addDay()))
|
||||
<a href="{{ route('delete_album', ['id' => $album->id]) }}"
|
||||
onclick="return confirm('Are you sure?')">
|
||||
<button type="button" class="btn btn-danger btn-md">Delete Album</button>
|
||||
|
||||
Reference in New Issue
Block a user