Skip to content

Instantly share code, notes, and snippets.

@exileed
Forked from anonymous/php
Last active March 20, 2017 20:07
Show Gist options
  • Save exileed/43e0342e3edc704121ad9611406ff8e3 to your computer and use it in GitHub Desktop.
Save exileed/43e0342e3edc704121ad9611406ff8e3 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 App\Models\Vehicles\Car;
use Illuminate\Http\Request;
use Storage;
class FuelingsController extends Controller
{
protected $model;
public function __construct(Car $model)
{
$this->model = $model;
}
// этот метод не нужен. А для чего он ?
public function getVehicle($id)
{
return call_user_func($this->_model . '::findOrFail', $id);
}
public function create($vehicleId)
{
return view('vehicles.fuelings.create', [
'vehicle' => $this->model->findOrFail($vehicleId),
'fuelTypes' => FuelType::all()->pluck('title', 'id'),
'vehicleType' => $this->model::VEHICLE_TYPE_TITLE,
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment