This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
15 changed files
with
350 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class ChannelMilestonePlatform extends Model { | ||
use HasFactory; | ||
|
||
protected $table = 'channel_milestone_platforms'; | ||
protected $fillable = ['channel_platform_id', 'milestone_platform_id', 'active']; | ||
|
||
public function channelPlatform() { | ||
return $this->belongsTo(ChannelPlatform::class); | ||
} | ||
|
||
public function milestonePlatform() { | ||
return $this->belongsTo(MilestonePlatform::class); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/Http/Controllers/Admin/ChannelMilestonePlatformController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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>.'); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/Http/Controllers/Admin/MilestonePlatformController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use App\MilestonePlatform; | ||
use App\Milestone; | ||
use App\Platform; | ||
|
||
class MilestonePlatformController extends Controller { | ||
public function store(Milestone $milestone, Platform $platform) { | ||
$this->authorize('edit_milestone'); | ||
|
||
$milestonePlatform = MilestonePlatform::create([ | ||
'milestone_id' => $milestone->id, | ||
'platform_id' => $platform->id | ||
]); | ||
|
||
return redirect()->back()->with('status', '<b>'.$milestonePlatform->platform->name.'</b> has been added to <b>'.$milestonePlatform->milestone->name.'</b>.'); | ||
} | ||
|
||
public function destroy(MilestonePlatform $milestonePlatform) { | ||
$this->authorize('edit_milestone'); | ||
|
||
$milestonePlatform->delete(); | ||
|
||
return redirect()->back()->with('status', '<b>'.$milestonePlatform->platform->name.'</b> has been removed from <b>'.$milestonePlatform->milestone->name.'</b>.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class MilestonePlatform extends Model { | ||
use HasFactory; | ||
|
||
protected $table = 'milestone_platforms'; | ||
protected $fillable = ['milestone_id', 'platform_id']; | ||
|
||
public function milestone() { | ||
return $this->belongsTo(Milestone::class); | ||
} | ||
|
||
public function platform() { | ||
return $this->belongsTo(Platform::class); | ||
} | ||
|
||
public function channelMilestonePlatform() { | ||
return $this->hasMany(ChannelMilestonePlatform::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
database/migrations/2020_12_02_214725_create_channel_milestone_platforms_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateChannelMilestonePlatformsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('channel_milestone_platforms', function (Blueprint $table) { | ||
$table->id(); | ||
$table->foreignId('channel_platform_id')->references('id')->on('channel_platforms'); | ||
$table->foreignId('milestone_platform_id')->references('id')->on('milestone_platforms'); | ||
$table->integer('active')->required()->default(1); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('channel_milestone_platforms'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.