类App \ Http \ Controllers \ Admin \ Point \ RedeemRequestsBoController不存在错误

时间:2019-12-06 14:50:13

标签: laravel

使用Laravel 5.6,我想在我的网站管理系统中创建页面预订室。

这是我的代码:

路线

Route::namespace('Point')->group(function () {
Route::get('/Admin/Point/redeem-requestsbo', 'RedeemRequestBoController@index');
// Crm Booking Room
        Route::delete('redeem-requestsbo/destroy', 'RedeemRequestsBoController@massDestroy')->name('redeem-requestsbo.massDestroy');
        Route::resource('redeem-requestsbo', 'RedeemRequestsBoController');

控制器

    namespace App\Http\Controllers\Admin\Point;


use App\CrmCustomer;
use App\Models\Point\RedeemBo;
use Illuminate\Support\Facades\Gate;
use App\Http\Controllers\Controller;
use Symfony\Component\HttpFoundation\Response;
use App\Http\Requests\Point\StoreRedeemRequestBoRequest;
use App\Http\Requests\Point\UpdateRedeemRequestBoRequest;
use App\Models\Point\RoomType;
use App\Models\Point\SpecialRate;
use Carbon\Carbon;

class RedeemRequestBoController extends Controller
{
    public function index()
    {
        abort_if(Gate::denies('view redeem request'), Response::HTTP_FORBIDDEN, '403 Forbidden');

        $roles = auth()->user()->roles->pluck('title')->toArray();
        $admin = in_array('Admin', $roles);

        if(!$admin) {
          $rows = RedeemBo::whereHas('crmCustomer', function($query){
              $query->where('email', auth()->user()->email);
          })->get();
        } else {
          $rows = RedeemBo::all();
        }

        return view('admin.point.redeem-requestsbo.index', compact('rows'));
    }

但是我出错了

Class App\Http\Controllers\Admin\Point\RedeemRequestsBoController does not exist error

booking room page file folder structure

1 个答案:

答案 0 :(得分:1)

RedeemRequestsBoController@massDestroy不存在,因为Controller类名称为RedeemRequestBoController带有(s)的RedeemRequest