目前我正在使用laravel。當我想通過視圖訪問控制器時。我收到我的方法未找到的錯誤。未找到Laravel控制器功能
Action App \ Http \ Controllers \ RidesController @ edit未定義。 (查看: C:\ WAMP \ WWW \資源\意見\遊戲機\ rides.blade.php)
但是當我嘗試它的工作原理自嘆不如指數的方法?我該怎麼辦?
這是我rides.blade.php:
</thead>
<tbody>
<tbody>
@foreach($rides as $ride)
<tr>
<td><a href="{!! action('[email protected]',$ride->id) !!}">{!! $ride->id !!}</a> </td>
<td>{!! $ride->created_at !!}</td>
<td>{!! $ride->beginstand !!}</td>
<td>{!! $ride->eindstand !!}</td>
<td>{!! $ride->van !!}</td>
<td>{!! $ride->naar !!}</td>
<td>{!! $ride->bezoekadres !!}</td>
<td>{!! $ride->geredenroute !!}</td>
<td>{!! $ride->karakterrit !!}</td>
<td>{!! $ride->toelichting !!}</td>
<td>{!! $ride->kilometerszakelijk !!}</td>
<td>{!! $ride->kilometersprive !!}</td>
</tr>
@endforeach
</tbody>
我的路線控制器:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\models\ridesregistration;
use App\Http\Requests\RideFormRequest;
class RidesController extends Controller
{
public function index()
{
$rides = ridesregistration::all();
return view("rides.rides",compact('rides'));
}
public function create()
{
return view('rides.create');
}
public function store(rideFormRequest $request)
{
$rides = new ridesregistration(array(
'beginstand' =>$request->get('beginstand'),
'eindstand' =>$request->get('eindstand'),
'van' =>$request->get('van'),
'naar' =>$request->get('naar'),
'bezoekadres' =>$request->get('bezoekadres'),
'geredenroute' =>$request->get('geredenroute'),
'karakterrit' =>$request->get('karakterrit'),
'toelichting' =>$request->get('toelichting'),
'kilometerszakelijk' =>$request->get('kilometerszakelijk'),
'kilometersprive' =>$request->get('kilometersprive')
));
$rides->save();
return redirect('/maakrit')->with('message','Rit '.$rides->id.' is succesvol aangemaakt.');
}
public function edit($id)
{
$rides = ridesregistration::whereId($id)->firstOrFail();
return view('rides.edit',compact('rides','rides'));
}
}
你爲什麼要使用小寫名稱爲模型的目錄和類名?該公約顯然是CamelCase。 –