-
-
Save exileed/43e0342e3edc704121ad9611406ff8e3 to your computer and use it in GitHub Desktop.
FuelingsController
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
<?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