This repository was archived by the owner on Nov 1, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathChannelMilestonePlatformController.php
More file actions
41 lines (30 loc) · 1.82 KB
/
ChannelMilestonePlatformController.php
File metadata and controls
41 lines (30 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\ChannelMilestonePlatform;
use App\MilestonePlatform;
use App\ChannelPlatform;
class ChannelMilestonePlatformController extends Controller {
public function store(MilestonePlatform $milestonePlatform, ChannelPlatform $channelPlatform) {
$this->authorize('edit_milestone');
$channelMilestonePlatform = ChannelMilestonePlatform::create([
'milestone_platform_id' => $milestonePlatform->id,
'channel_platform_id' => $channelPlatform->id,
'active' => 1
]);
return redirect()->back()->with('status', '<b>'.$channelPlatform->name.'</b> has been added to <b>'.$milestonePlatform->platform->name.'</b> for <b>'.$milestonePlatform->milestone->name.'</b>.');
}
public function toggle(ChannelMilestonePlatform $channelMilestonePlatform) {
$this->authorize('edit_milestone');
$channelMilestonePlatform->update([
'active' => $channelMilestonePlatform->active === 1 ? 0 : 1
]);
return redirect()->back()->with('status', '<b>'.$channelMilestonePlatform->channelPlatform->name.'</b> has been toggled for <b>'.$channelMilestonePlatform->milestonePlatform->platform->name.'</b> for <b>'.$channelMilestonePlatform->milestonePlatform->milestone->name.'</b>.');
}
public function destroy(ChannelMilestonePlatform $channelMilestonePlatform) {
$this->authorize('edit_milestone');
$channelMilestonePlatform->delete();
return redirect()->back()->with('status', '<b>'.$channelMilestonePlatform->channelPlatform->name.'</b> has been removed from <b>'.$channelMilestonePlatform->milestonePlatform->platform->name.'</b> for <b>'.$channelMilestonePlatform->milestonePlatform->milestone->name.'</b>.');
}
}