Skip to content

Instantly share code, notes, and snippets.

/php

Created March 20, 2017 19:59
Show Gist options
  • Save anonymous/3d3ffea5af84d990bdb5dfaab6787447 to your computer and use it in GitHub Desktop.
Save anonymous/3d3ffea5af84d990bdb5dfaab6787447 to your computer and use it in GitHub Desktop.
FuelingsController
<?php
namespace App\Http\Controllers\Vehicles;
use App\Helpers\CarbonFormatter;
use App\Http\Controllers\Controller;
use App\Models\Dictionaries\FuelType;
use App\Models\Vehicles\Fueling;
use Illuminate\Http\Request;
use Storage;
class FuelingsController extends Controller
{
protected $_model;
public function getVehicle($id)
{
return call_user_func($this->_model . '::findOrFail', $id);
}
public function create($vehicleId)
{
return view('vehicles.fuelings.create', [
'vehicle' => $this->getVehicle($vehicleId),
'fuelTypes' => FuelType::all()->pluck('title', 'id'),
'vehicleType' => str_plural(constant($this->_model . '::VEHICLE_TYPE_TITLE'))
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment