mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-30 01:34:16 +00:00
Commit although could not run on localhost
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Announcement;//call to announcement controller folder
|
||||
use App\Http\Controllers\Controller;//call to controller class
|
||||
|
||||
use App\Models\Announcement;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteAnnouncementController extends Controller
|
||||
{
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$announcement = Announcement::findOrFail($id);
|
||||
$deleted = $announcement->delete();
|
||||
|
||||
if($deleted)
|
||||
{
|
||||
session()->put('success', 'Announcement Successfully Deleted!');
|
||||
return redirect()->back();
|
||||
}
|
||||
//the else part
|
||||
session()->put('error', 'There was an error deleting this announcement!');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user