InfyOm Laravel Generator를 사용하여 컨트롤러, 모델, 뷰 등을 만들었습니다.InfraOm Laravel Generator로 Laravel의 새로운 기능을 읽는 방법?
나는 실행
<?php
namespace App\Http\Controllers;
use App\Http\Requests\CreatehotelRequest;
use App\Http\Requests\UpdatehotelRequest;
use App\Repositories\hotelRepository;
use App\Http\Controllers\AppBaseController;
use Illuminate\Http\Request;
use Flash;
use Prettus\Repository\Criteria\RequestCriteria;
use Response;
class hotelController extends AppBaseController
{
/** @var hotelRepository */
private $hotelRepository;
public function __construct(hotelRepository $hotelRepo)
{
$this->hotelRepository = $hotelRepo;
}
/**
* Display a listing of the hotel.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$this->hotelRepository->pushCriteria(new RequestCriteria($request));
$hotels = $this->hotelRepository->all();
return view('hotels.index')
->with('hotels', $hotels);
}
/**
* Show the form for creating a new hotel.
*
* @return Response
*/
public function create()
{
die('hotel view');
return view('hotels.create');
}
public function test()
{
die('test view');
}
/**
* Store a newly created hotel in storage.
*
* @param CreatehotelRequest $request
*
* @return Response
*/
public function store(CreatehotelRequest $request)
{
$input = $request->all();
$hotel = $this->hotelRepository->create($input);
Flash::success('Hotel saved successfully.');
return redirect(route('hotels.index'));
}
/**
* Display the specified hotel.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
$hotel = $this->hotelRepository->findWithoutFail($id);
if (empty($hotel)) {
Flash::error('Hotel not found');
return redirect(route('hotels.index'));
}
return view('hotels.show')->with('hotel', $hotel);
}
/**
* Show the form for editing the specified hotel.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
$hotel = $this->hotelRepository->findWithoutFail($id);
if (empty($hotel)) {
Flash::error('Hotel not found');
return redirect(route('hotels.index'));
}
return view('hotels.edit')->with('hotel', $hotel);
}
/**
* Update the specified hotel in storage.
*
* @param int $id
* @param UpdatehotelRequest $request
*
* @return Response
*/
public function update($id, UpdatehotelRequest $request)
{
$hotel = $this->hotelRepository->findWithoutFail($id);
if (empty($hotel)) {
Flash::error('Hotel not found');
return redirect(route('hotels.index'));
}
$hotel = $this->hotelRepository->update($request->all(), $id);
Flash::success('Hotel updated successfully.');
return redirect(route('hotels.index'));
}
/**
* Remove the specified hotel from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id)
{
$hotel = $this->hotelRepository->findWithoutFail($id);
if (empty($hotel)) {
Flash::error('Hotel not found');
return redirect(route('hotels.index'));
}
$this->hotelRepository->delete($id);
Flash::success('Hotel deleted successfully.');
return redirect(route('hotels.index'));
}
}
I : http://labs.infyom.com/laravelgenerator/docs/5.3/getting-started#generator-commands
그것은 컨트롤러, 모델, 뷰 등
이 같은 컨트롤러의 호텔을 생성 : 나는에서이 명령을 받았습니다
php artisan infyom:scaffold Hotel
URL을 http://localhost/adminlte-generator/public/hotels/create과 같이 호출하면 결과는 다음과 같습니다. 호텔보기
새로운 기능을 추가합니다. 기능은 테스트입니다. 그런 다음 URL을 http://localhost/adminlte-generator/public/hotels/test과 같이 호출합니다. 테스트보기가 표시되지 않습니다.
내 문제를 해결하는 솔루션이 있습니까?
나는 내 경로에 등록했다. 하지만 작동하지 않습니다 –
@samueltoh 무엇이 오류입니까? –
오류가 없습니다. 하지만'http : // localhost/adminlte-generator/public/hotels/test'를 호출하면'test view'가 표시되지 않지만'http : // localhost/adminlte-generator/public/hotels'로 돌아갑니다 –