_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q257600
GameServer.updatePlayers
test
public function updatePlayers($rconPassword = null) { $this->handleResponseForRequest(self::REQUEST_PLAYER); if(!$this->rconAuthenticated) { if($rconPassword == null) { return; } $this->rconAuth($rconPassword); } $players = []; ...
php
{ "resource": "" }
q257601
SteamPlayer.addInformation
test
public function addInformation($playerData) { if($playerData['name'] != $this->name) { throw new SteamCondenserException('Information to add belongs to a different player.'); } $this->extended = true; $this->connectionId = intval($playerData['userid']); if(array_key_...
php
{ "resource": "" }
q257602
GameLeaderboard.getLeaderboard
test
public static function getLeaderboard($gameName, $id) { $leaderboards = self::getLeaderboards($gameName); if (is_int($id)) { if (array_key_exists($id, $leaderboards)) { return $leaderboards[$id]; } else { return null; } } else ...
php
{ "resource": "" }
q257603
GameLeaderboard.getLeaderboards
test
public static function getLeaderboards($gameName) { if(!array_key_exists($gameName, self::$leaderboards)) { self::loadLeaderboards($gameName); } return self::$leaderboards[$gameName]; }
php
{ "resource": "" }
q257604
GameLeaderboard.loadLeaderboards
test
private static function loadLeaderboards($gameName) { $url = "http://steamcommunity.com/stats/$gameName/leaderboards/?xml=1"; $boardsData = new \SimpleXMLElement(file_get_contents($url)); if(!empty($boardsData->error)) { throw new SteamCondenserException((string) $boardsData->error)...
php
{ "resource": "" }
q257605
GameLeaderboard.getEntryForSteamId
test
public function getEntryForSteamId($steamId) { if (is_object($steamId)) { $id = $steamId->getSteamId64(); } else { $id = $steamId; } $xml = $this->loadDataForSteamId($id); foreach($xml->entries->entry as $entryData) { if($entryData->steamid =...
php
{ "resource": "" }
q257606
GameLeaderboard.getEntryRange
test
public function getEntryRange($first, $last) { if($last < $first) { throw new SteamCondenserException('First entry must be prior to last entry for leaderboard entry lookup.'); } if(($last - $first) > 5000) { throw new SteamCondenserException('Leaderboard entry lookup is c...
php
{ "resource": "" }
q257607
GameLeaderboard.loadData
test
protected function loadData(array $params) { $url = $this->url; if (!empty($params)) { $url_params = []; foreach($params as $k => $v) { $url_params[] = "$k=$v"; } $url .= '&' . join('&', $url_params); } $xml = new \SimpleXM...
php
{ "resource": "" }
q257608
GameLeaderboard.loadDataForSteamId
test
protected function loadDataForSteamId($steamId) { if (is_object($steamId)) { $id = $steamId->getSteamId64(); } else { $id = $steamId; } return $this->loadData(['steamid' => $id]); }
php
{ "resource": "" }
q257609
GameLeaderboard.parseEntries
test
protected function parseEntries(\SimpleXMLElement $xml) { $entries = []; foreach($xml->entries->entry as $entryData) { $rank = (int) $entryData->rank; $entries[$rank] = new GameLeaderboardEntry($entryData, $this); } return $entries; }
php
{ "resource": "" }
q257610
SteamGame.create
test
public static function create(\stdClass $gameData) { if(array_key_exists($gameData->appid, self::$games)) { return self::$games[$gameData->appid]; } else { return new SteamGame($gameData); } }
php
{ "resource": "" }
q257611
SteamGame.checkUpToDate
test
public static function checkUpToDate($appId, $version) { $params = ['appid' => $appId, 'version' => $version]; $result = WebApi::getJSONObject('ISteamApps', 'UpToDateCheck', 1, $params); $result = $result->response; if(!$result->success) { throw new SteamCondenserException($r...
php
{ "resource": "" }
q257612
SteamGame.getPlayerCount
test
public function getPlayerCount() { $params = ['appid' => $this->appId]; $result = WebApi::getJSONObject('ISteamUserStats', 'GetNumberOfCurrentPlayers', 1, $params); return $result->response->player_count; }
php
{ "resource": "" }
q257613
SteamGame.getUserStats
test
public function getUserStats($steamId) { if(!$this->hasStats()) { return null; } return GameStats::create($steamId, $this->appId); }
php
{ "resource": "" }
q257614
WorkOrderPartProcessor.index
test
public function index($workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $parts = $this->presenter->table($workOrder); $inventory = $this->presenter->tableInventory($workOrder, $this->inventory); $navbarParts = $this->presenter->navbarParts($workOrder); ...
php
{ "resource": "" }
q257615
Controller.store
test
public function store(Request $request) { $event = $this->event->create($request); if ($event) { $message = 'Successfully created event.'; return redirect()->route('maintenance.events.index')->withSuccess($message); } else { $message = 'There was an issu...
php
{ "resource": "" }
q257616
Controller.show
test
public function show($id) { $event = $this->event->find($id); $apiObject = $this->event->findApiObject($event->api_id); if ($apiObject) { return view('events.show', compact('event', 'apiObject')); } abort(404); }
php
{ "resource": "" }
q257617
Controller.update
test
public function update(Request $request, $id) { $event = $this->event->update($request, $id); if ($event) { $message = 'Successfully updated event.'; return redirect()->route('maintenance.events.show', [$event->id])->withSuccess($message); } else { $mess...
php
{ "resource": "" }
q257618
Controller.destroy
test
public function destroy($id) { if ($this->event->delete($id)) { $message = 'Successfully deleted event'; return redirect()->route('maintenance.events.index')->withSuccess($message); } else { $message = 'There was an error trying to delete this event. Please try a...
php
{ "resource": "" }
q257619
WorkOrderProcessor.show
test
public function show($id) { $workOrder = $this->workOrder->findOrFail($id); $sessions = $this->presenter->tableSessions($workOrder); $history = $this->presenter->tableHistory('work-orders', $workOrder->revisions()); $navbar = $this->presenter->navbarShow($workOrder); $for...
php
{ "resource": "" }
q257620
WorkOrderProcessor.edit
test
public function edit($id) { $workOrder = $this->workOrder->findOrFail($id); $form = $this->presenter->form($workOrder); return view('work-orders.edit', compact('form')); }
php
{ "resource": "" }
q257621
WorkOrderProcessor.update
test
public function update(WorkOrderRequest $request, $id) { $workOrder = $this->workOrder->findOrFail($id); return $this->dispatch(new Update($request, $workOrder)); }
php
{ "resource": "" }
q257622
WorkOrderPartStockController.getTake
test
public function getTake($workOrderId, $itemId, $stockId) { return $this->processor->getTake($workOrderId, $itemId, $stockId); }
php
{ "resource": "" }
q257623
WorkOrderPartStockController.postTake
test
public function postTake(PartTakeRequest $request, $workOrderId, $itemId, $stockId) { try { if ($this->processor->postTake($request, $workOrderId, $itemId, $stockId)) { flash()->success('Success!', 'Successfully added parts to work order.'); return redirect()->ro...
php
{ "resource": "" }
q257624
WorkOrderPartStockController.getPut
test
public function getPut($workOrderId, $inventoryId, $stockId) { return $this->processor->getPut($workOrderId, $inventoryId, $stockId); }
php
{ "resource": "" }
q257625
WorkOrderPartStockController.postPut
test
public function postPut(PartReturnRequest $request, $workOrderId, $inventoryId, $stockId) { if ($this->processor->postPut($request, $workOrderId, $inventoryId, $stockId)) { flash()->success('Success!', 'Successfully returned parts to the inventory.'); return redirect()->route('maint...
php
{ "resource": "" }
q257626
Controller.show
test
public function show($id) { $workRequest = $this->workRequest->model()->findOrFail($id); return view('client.work-requests.show', compact('workRequest')); }
php
{ "resource": "" }
q257627
Controller.edit
test
public function edit($id) { $workRequest = $this->workRequest->model()->findOrFail($id); return view('client.work-requests.edit', compact('workRequest')); }
php
{ "resource": "" }
q257628
Controller.update
test
public function update(WorkRequest $request, $id) { $workRequest = $this->workRequest->update($request, $id); if ($workRequest) { $message = 'Successfully updated work request.'; return redirect()->route('maintenance.client.work-requests.show', [$workRequest->id])->withSucc...
php
{ "resource": "" }
q257629
Controller.destroy
test
public function destroy($id) { $workRequest = $this->workRequest->model()->findOrFail($id); if ($workRequest->delete()) { $message = 'Successfully deleted work request.'; return redirect()->route('maintenance.client.work-requests.index')->withSuccess($message); } el...
php
{ "resource": "" }
q257630
HasLocationTrait.scopeLocation
test
public function scopeLocation($query, $locationId = null) { if (!is_null($locationId)) { // Get descendants and self inventory category nodes $locations = Location::find($locationId)->getDescendantsAndSelf(); // Perform a sub-query on main query $query->where...
php
{ "resource": "" }
q257631
ReportController.store
test
public function store(ReportRequest $request, $eventId) { $report = $this->event->createReport($request, $eventId); if ($report) { $message = 'Successfully created event report.'; return redirect()->route('maintenance.events.show', [$eventId, '#tab-report'])->withSuccess($m...
php
{ "resource": "" }
q257632
WorkOrderAttachmentProcessor.create
test
public function create($workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $form = $this->presenter->form($workOrder, $workOrder->attachments()->getRelated()); return view('work-orders.attachments.create', compact('form')); }
php
{ "resource": "" }
q257633
WorkOrderAttachmentProcessor.store
test
public function store(AttachmentRequest $request, $workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); return $this->dispatch(new Store($request, $workOrder->attachments())); }
php
{ "resource": "" }
q257634
WorkOrderAttachmentProcessor.show
test
public function show($workOrderId, $attachmentId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $attachment = $workOrder->attachments()->findOrFail($attachmentId); return view('work-orders.attachments.show', compact('workOrder', 'attachment')); }
php
{ "resource": "" }
q257635
WorkOrderAttachmentProcessor.edit
test
public function edit($workOrderId, $attachmentId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $attachment = $workOrder->attachments()->findOrFail($attachmentId); $form = $this->presenter->form($workOrder, $attachment); return view('work-orders.attachments.edit', com...
php
{ "resource": "" }
q257636
WorkOrderAttachmentProcessor.update
test
public function update(AttachmentUpdateRequest $request, $workOrderId, $attachmentId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $attachment = $workOrder->attachments()->findOrFail($attachmentId); return $this->dispatch(new Update($request, $attachment)); }
php
{ "resource": "" }
q257637
WorkOrderAttachmentProcessor.destroy
test
public function destroy($workOrderId, $attachmentId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $attachment = $workOrder->attachments()->findOrFail($attachmentId); return $this->dispatch(new Destroy($attachment)); }
php
{ "resource": "" }
q257638
WorkOrderReportPresenter.form
test
public function form(WorkOrder $workOrder, WorkOrderReport $report) { return $this->form->of('work-orders.report', function (FormGrid $form) use ($workOrder, $report) { if ($report->exists) { $method = 'PATCH'; $url = route('maintenance.work-orders.report.update',...
php
{ "resource": "" }
q257639
Notification.getIconAttribute
test
public function getIconAttribute() { $class = $this->attributes['notifiable_type']; /* * Resolve the configuration service from the IoC since * we don't want to override the Notification models constructor * to inject the service */ $config = App::make(Co...
php
{ "resource": "" }
q257640
StockMovementController.index
test
public function index($inventory_id, $stock_id) { $item = $this->inventory->find($inventory_id); $stock = $this->inventoryStock->find($stock_id); $data = $this->inputAll(); $data['stock_id'] = $stock->id; $movements = $this->inventoryStockMovement->setInput($data)->getByPag...
php
{ "resource": "" }
q257641
StockMovementController.show
test
public function show($inventory_id, $stock_id, $movement_id) { $item = $this->inventory->find($inventory_id); $stock = $this->inventoryStock->find($stock_id); $movement = $this->inventoryStockMovement->find($movement_id); return view('inventory.stocks.movements.show', [ ...
php
{ "resource": "" }
q257642
StockMovementController.rollback
test
public function rollback($inventory_id, $stock_id, $movement_id) { $item = $this->inventory->find($inventory_id); $stock = $this->inventoryStock->find($stock_id); $movement = $this->inventoryStockMovement->find($movement_id); if ($stock->rollback($movement)) { $this->mes...
php
{ "resource": "" }
q257643
WorkOrder.getRevisedStatusAttribute
test
public function getRevisedStatusAttribute($id) { if ($id) { $status = $this->status()->find($id); if ($status instanceof Status) { return $status->getLabel(); } } return; }
php
{ "resource": "" }
q257644
WorkOrder.getRevisedPriorityAttribute
test
public function getRevisedPriorityAttribute($id) { if ($id) { $priority = $this->priority()->find($id); if ($priority instanceof Priority) { return $priority->getLabel(); } } return; }
php
{ "resource": "" }
q257645
WorkOrder.closeSessions
test
public function closeSessions() { $closed = []; foreach ($this->sessions as $session) { if ($session instanceof WorkOrderSession && is_null($session->out)) { $session->out = $this->freshTimestamp(); if ($session->save()) { $closed[] =...
php
{ "resource": "" }
q257646
WorkOrder.userCheckedIn
test
public function userCheckedIn() { $session = $this->getCurrentSession(); if ($session instanceof WorkOrderSession) { return $session->in && is_null($session->out); } return false; }
php
{ "resource": "" }
q257647
WorkOrder.getStartedAtLabel
test
public function getStartedAtLabel() { if ($this->started_at) { $class = 'label label-success'; $icon = 'fa fa-check'; $message = $this->started_at; } else { $class = 'label label-danger'; $icon = 'fa fa-times'; $message = 'Has n...
php
{ "resource": "" }
q257648
WorkOrder.getCompletedAtLabel
test
public function getCompletedAtLabel() { if ($this->isComplete()) { $class = 'label label-success'; $icon = 'fa fa-check'; $message = $this->completed_at; } else { $class = 'label label-danger'; $icon = 'fa fa-times'; $message = ...
php
{ "resource": "" }
q257649
WorkOrder.complete
test
public function complete($statusId) { if (is_null($this->started_at)) { $this->started_at = $this->freshTimestamp(); } $this->completed_at = $this->freshTimestamp(); $this->status_id = $statusId; return $this->save(); }
php
{ "resource": "" }
q257650
WorkOrderStatusPresenter.table
test
public function table(Status $status) { return $this->table->of('work-orders.statuses', function (TableGrid $table) use ($status) { $table->with($status)->paginate($this->perPage); $table->column('Status', function (Column $column) { $column->value = function (Status...
php
{ "resource": "" }
q257651
WorkOrderStatusPresenter.form
test
public function form(Status $status) { return $this->form->of('work-orders.statuses', function (FormGrid $form) use ($status) { if ($status->exists) { $method = 'PATCH'; $url = route('maintenance.work-orders.statuses.update', [$status->getKey()]); ...
php
{ "resource": "" }
q257652
WorkOrderPriorityProcessor.index
test
public function index() { $priorities = $this->presenter->table($this->priority); $navbar = $this->presenter->navbar(); return view('work-orders.priorities.index', compact('priorities', 'navbar')); }
php
{ "resource": "" }
q257653
WorkOrderPriorityProcessor.store
test
public function store(PriorityRequest $request) { $priority = $this->priority->newInstance(); return $this->dispatch(new Store($request, $priority)); }
php
{ "resource": "" }
q257654
WorkOrderPriorityProcessor.edit
test
public function edit($id) { $priority = $this->priority->findOrFail($id); $form = $this->presenter->form($priority); return view('work-orders.priorities.edit', compact('form')); }
php
{ "resource": "" }
q257655
WorkOrderPriorityProcessor.update
test
public function update(PriorityRequest $request, $id) { $priority = $this->priority->findOrFail($id); return $this->dispatch(new Update($request, $priority)); }
php
{ "resource": "" }
q257656
Inventory.scopeStock
test
public function scopeStock($query, $operator = null, $stock = null) { if ($operator && $stock) { return $query->whereHas('stocks', function ($query) use ($operator, $stock) { if ($output = $this->getOperator($operator)) { return $query->where('quantity', $outp...
php
{ "resource": "" }
q257657
Inventory.scopeSku
test
public function scopeSku($query, $sku = null) { if ($sku) { return $query->whereHas('sku', function ($query) use ($sku) { return $query->where('code', 'LIKE', '%'.$sku.'%'); }); } return $query; }
php
{ "resource": "" }
q257658
Inventory.getCurrentStockAttribute
test
public function getCurrentStockAttribute() { $stock = $this->getTotalStock(); if ($this->hasMetric()) { return sprintf('%s %s', $stock, $this->getMetricSymbol()); } return $stock; }
php
{ "resource": "" }
q257659
Inventory.getRevisedMetricAttribute
test
public function getRevisedMetricAttribute($id) { if ($id) { $metric = $this->metric()->find($id); if ($metric) { return $metric->name; } } return; }
php
{ "resource": "" }
q257660
Model.getOperator
test
protected function getOperator($string) { $allowed_operators = ['>', '<', '=', '>=', '<=']; $output = preg_split("/[\[\]]/", $string); if (is_array($output)) { if (array_key_exists('1', $output) && array_key_exists('2', $output)) { if (in_array($output[1], $allo...
php
{ "resource": "" }
q257661
Model.scopeSort
test
public function scopeSort($query, $field = null, $sort = null) { /* * Make sure both the field and sort variables are present */ if ($field && $sort) { /* * Retrieve all column names for the current model table */ $columns = Schema:...
php
{ "resource": "" }
q257662
Attachment.getFullPathAttribute
test
public function getFullPathAttribute() { $config = sprintf('filesystems.%s.root', $this->getDisk()); $default = storage_path('app'); $basePath = config($config, $default); return $basePath.DIRECTORY_SEPARATOR.$this->file_path; }
php
{ "resource": "" }
q257663
WorkOrderStatusProcessor.index
test
public function index() { $statuses = $this->presenter->table($this->status); $navbar = $this->presenter->navbar(); return view('work-orders.statuses.index', compact('statuses', 'navbar')); }
php
{ "resource": "" }
q257664
WorkOrderStatusProcessor.store
test
public function store(StatusRequest $request) { $status = $this->status->newInstance(); return $this->dispatch(new Store($request, $status)); }
php
{ "resource": "" }
q257665
WorkOrderStatusProcessor.edit
test
public function edit($id) { $status = $this->status->findOrFail($id); $form = $this->presenter->form($status); return view('work-orders.statuses.edit', compact('form')); }
php
{ "resource": "" }
q257666
WorkOrderStatusProcessor.update
test
public function update(StatusRequest $request, $id) { $status = $this->status->findOrFail($id); return $this->dispatch(new Update($request, $status)); }
php
{ "resource": "" }
q257667
InventoryVariantProcessor.create
test
public function create($itemId) { $item = $this->inventory->findOrFail($itemId); $form = $this->presenter->form($item, $variant = true); return view('inventory.variants.create', compact('form')); }
php
{ "resource": "" }
q257668
InventoryVariantProcessor.store
test
public function store(InventoryRequest $request, $itemId) { $item = $this->inventory->findOrFail($itemId); $variant = $item->newVariant(); $variant->name = $request->input('name', $item->name); $variant->category_id = $request->input('category', $item->category_id); $varian...
php
{ "resource": "" }
q257669
WorkOrderReportProcessor.create
test
public function create($workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); if ($workOrder->isComplete()) { throw new ReportExistsException(); } $form = $this->presenter->form($workOrder, $this->report); return view('work-orders.report.creat...
php
{ "resource": "" }
q257670
WorkOrderReportProcessor.store
test
public function store(ReportRequest $request, $workOrderId) { $workOrder = $this->workOrder->findOrFail($workOrderId); $report = $this->report->newInstance(); return $this->dispatch(new Store($request, $workOrder, $report)); }
php
{ "resource": "" }
q257671
WorkOrderPresenter.table
test
public function table($workOrder) { return $this->table->of('work-orders', function (TableGrid $table) use ($workOrder) { $table->with($workOrder)->paginate($this->perPage); $table->attributes([ 'class' => 'table table-hover table-striped', ]); ...
php
{ "resource": "" }
q257672
WorkOrderPresenter.tableAssigned
test
public function tableAssigned($workOrder) { $workOrder = $workOrder->whereHas('assignments', function (Builder $query) { $query->where('to_user_id', auth()->id()); }); return $this->table($workOrder); }
php
{ "resource": "" }
q257673
WorkOrderPresenter.tableSessions
test
public function tableSessions(WorkOrder $workOrder) { $presenter = new WorkOrderSessionPresenter($this->form, $this->table); return $presenter->tablePerWorker($workOrder); }
php
{ "resource": "" }
q257674
WorkOrderPresenter.form
test
public function form(WorkOrder $workOrder) { return $this->form->of('work-orders', function (FormGrid $form) use ($workOrder) { if ($workOrder->exists) { $method = 'PATCH'; $url = route('maintenance.work-orders.update', [$workOrder->getKey()]); $fo...
php
{ "resource": "" }
q257675
WorkOrderPresenter.formComment
test
public function formComment(WorkOrder $workOrder, Comment $comment) { $presenter = new WorkOrderCommentPresenter($this->form, $this->table); return $presenter->form($workOrder, $comment); }
php
{ "resource": "" }
q257676
Store.handle
test
public function handle(Filesystem $filesystem) { $files = $this->request->file('files'); if (is_array($files)) { $uploaded = []; foreach ($files as $file) { // Double check that we have an uploaded file instance. if ($file instanceof Uploaded...
php
{ "resource": "" }
q257677
AssetPresenter.table
test
public function table(Asset $asset) { return $this->table->of('assets', function (TableGrid $table) use ($asset) { $table->with($asset)->paginate($this->perPage); $table->attributes([ 'class' => 'table table-hover table-striped', ]); $table->...
php
{ "resource": "" }
q257678
AssetPresenter.form
test
public function form(Asset $asset) { return $this->form->of('assets', function (FormGrid $form) use ($asset) { if ($asset->exists) { $method = 'PATCH'; $route = route('maintenance.assets.update', [$asset->getKey()]); $form->submit = 'Save'; ...
php
{ "resource": "" }
q257679
InventoryPresenter.table
test
public function table($item) { return $this->table->of('inventory', function (TableGrid $table) use ($item) { $table->with($item)->paginate($this->perPage); $table->attributes([ 'class' => 'table table-hover table-striped', ]); $table->column...
php
{ "resource": "" }
q257680
InventoryPresenter.tableStocks
test
public function tableStocks(Inventory $item) { return (new InventoryStockPresenter($this->form, $this->table))->table($item); }
php
{ "resource": "" }
q257681
InventoryPresenter.form
test
public function form(Inventory $inventory, $variant = false) { return $this->form->of('inventory', function (FormGrid $form) use ($inventory, $variant) { if ($inventory->exists) { if ($variant === true) { // If the inventory item exists and we're looking to cr...
php
{ "resource": "" }
q257682
InventoryPresenter.navbarStocks
test
public function navbarStocks(Inventory $item) { return (new InventoryStockPresenter($this->form, $this->table))->navbar($item); }
php
{ "resource": "" }
q257683
WorkOrderAttachmentController.store
test
public function store(AttachmentRequest $request, $workOrderId) { if ($uploaded = $this->processor->store($request, $workOrderId)) { $count = (is_array($uploaded) ? count($uploaded) : 0); flash()->success('Success!', "Successfully uploaded $count file(s)."); return redi...
php
{ "resource": "" }
q257684
WorkOrderAttachmentController.update
test
public function update(AttachmentUpdateRequest $request, $workOrderId, $attachmentId) { if ($this->processor->update($request, $workOrderId, $attachmentId)) { flash()->success('Success!', 'Successfully updated attachment.'); return redirect()->route('maintenance.work-orders.attachme...
php
{ "resource": "" }
q257685
MetricPresenter.table
test
public function table(Metric $metric) { return $this->table->of('metrics', function (TableGrid $table) use ($metric) { $table->with($metric)->paginate($this->perPage); $table->column('name'); $table->column('symbol'); $table->column('Created', 'created_at'); ...
php
{ "resource": "" }
q257686
Presenter.tableHistory
test
public function tableHistory($for, MorphMany $revisions) { return $this->table->of("$for.revisions", function (TableGrid $table) use ($revisions) { $table->with($revisions)->paginate($this->perPage); $table->pageName = 'history'; $table->column('user_responsible', funct...
php
{ "resource": "" }
q257687
ImageController.store
test
public function store(ImageRequest $request, $id) { $asset = $this->asset->find($id); $attachments = $this->image->upload($request, $asset, $asset->images()); if ($attachments) { $message = 'Successfully uploaded files.'; return redirect()->route('maintenance.asset...
php
{ "resource": "" }
q257688
ImageController.show
test
public function show($id, $imageId) { $asset = $this->asset->find($id); $image = $asset->images()->find($imageId); if ($image) { return view('assets.images.show', compact('asset', 'image')); } abort(404); }
php
{ "resource": "" }
q257689
ImageController.update
test
public function update(AttachmentUpdateRequest $request, $id, $imageId) { $asset = $this->asset->find($id); $image = $this->image->update($request, $asset->images(), $imageId); if ($image) { $message = 'Successfully updated image.'; return redirect()->route('mainte...
php
{ "resource": "" }
q257690
MetricProcessor.index
test
public function index() { $metrics = $this->presenter->table($this->metric); $navbar = $this->presenter->navbar(); return view('metrics.index', compact('metrics', 'navbar')); }
php
{ "resource": "" }
q257691
MetricProcessor.store
test
public function store(MetricRequest $request) { $metric = $this->metric->newInstance(); return $this->dispatch(new Store($request, $metric)); }
php
{ "resource": "" }
q257692
MetricProcessor.edit
test
public function edit($id) { $metric = $this->metric->findOrFail($id); $form = $this->presenter->form($metric); return view('metrics.edit', compact('form')); }
php
{ "resource": "" }
q257693
AssetProcessor.index
test
public function index() { $navbar = $this->presenter->navbar(); $assets = $this->presenter->table($this->asset); return view('assets.index', compact('assets', 'navbar')); }
php
{ "resource": "" }
q257694
AssetProcessor.store
test
public function store(AssetRequest $request) { $asset = $this->asset->newInstance(); $asset->user_id = $this->guard->id(); $asset->tag = $request->input('tag'); $asset->category_id = $request->input('category'); $asset->location_id = $request->input('location'); $ass...
php
{ "resource": "" }
q257695
AssetProcessor.edit
test
public function edit($id) { $asset = $this->asset->findOrFail($id); $form = $this->presenter->form($asset); return view('assets.edit', compact('form')); }
php
{ "resource": "" }
q257696
AssetProcessor.update
test
public function update(AssetRequest $request, $id) { $asset = $this->asset->findOrFail($id); $asset->tag = $request->input('tag'); $asset->category_id = $request->input('category'); $asset->location_id = $request->input('location'); $asset->name = $request->input('name'); ...
php
{ "resource": "" }
q257697
HasScopeIdTrait.scopeId
test
public function scopeId($query, $id = null) { if (!is_null($id)) { $query->where('id', $id); } return $query; }
php
{ "resource": "" }
q257698
Controller.response
test
public function response() { if ($this->isAjax()) { if ($this->errors) { return $this->responseJson([ 'errors' => $this->errors, ]); } else { return $this->responseJson([ 'message' => $this->m...
php
{ "resource": "" }
q257699
Controller.input
test
protected function input($name, $clean = false) { if ($this->inputHas($name)) { if ($clean) { return $this->clean(Input::get($name)); } else { return Input::get($name); } } return; }
php
{ "resource": "" }