Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created October 5, 2020 21:03
Show Gist options
  • Save jongravois/b76132f087e50d9f83404eb63bc55cbf to your computer and use it in GitHub Desktop.
Save jongravois/b76132f087e50d9f83404eb63bc55cbf to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Livewire\Flightdeck;
use App\Models\Module;
use App\Models\ModuleFeatureSpec;
use App\Models\User;
use Livewire\Component;
class ModuleInfo extends Component
{
public $moduleID;
public $module;
public $display = false;
public $creator = false;
public $showSpecs = false;
public $editing;
public $selectedFeature;
public $features = [];
public $specs = [];
public $sponsors = [];
public $timeline = [];
public $title;
public $user_id;
public $description = '';
public $newSpec = '';
public $isActive = false;
public $isInDev = false;
public function mount($id)
{
$this->moduleID = $id;
$this->sponsors = User::query()
->whereCanSponsor(true)
->select(['id', 'first_name', 'last_name', 'name'])
->orderBy('last_name')
->get();
} // end function
public function render()
{
$module = Module::with('features')->find($this->moduleID);
$this->features = $module->features;
$this->module = $module;
$this->specs = ($this->selectedFeature ?
ModuleFeatureSpec::whereModuleFeatureId($this->selectedFeature)->get()
: []);
return view('livewire.flightdeck.module-info');
}
public function cancel()
{
$this->display = false;
$this->creator = false;
$this->showSpecs = false;
$this->editing = null;
$this->selectedFeature = null;
} // end function
public function createFeature()
{
//dd('creature feature');
$this->creator = true;
} // end function
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment