samedi 29 décembre 2018

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seaurchin.availableroom' doesn't exist (42S02)

I'm trying to get the available room at specified date by the client. So far I tried using join and left join to get the available room.

Controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\RedirectResponse;
use App\client;
use App\reservation;
use App\booking;
use App\availableRoom;
use App\roomType;
use App\amenities;
use App\payment;
use App\roomReserved;
use App\Mail\ReservationDetail;
use Carbon\Carbon;
class ReservationController extends Controller
{

    private $_availablerooms;

    /**
     * ReservationController constructor.
     */
    public function __construct()
    {
        $this->_availablerooms = new availableRoom();
    }


    /**
     * @param Request $request
     * @return mixed
     */
    public function checkAvailable(Request $request){
        $checkInDate = date("d-m-Y", strtotime($request->start_date));
        $checkOutDate = date("d-m-Y", strtotime($request->end_date));

        $availableRooms = $this->_availablerooms->from('availableRoom as r')
            ->selectRaw('*,r.roomDoorNum, r.isAvailable, rt.title as roomType,res.roomReservedID')
            ->join('roomtype as rt','rt.roomTypeID','=','r.roomTypeID')
            ->leftjoin('roomReserved as rr','rr.roomID','=','r.roomID')
            ->leftjoin('reservation as res','res.roomReservedID','=', DB::raw('rr.roomReservedID AND (res.reservationDate BETWEEN '."$checkInDate".' AND ' ."$checkOutDate". ' OR res.expiryDate BETWEEN '."$checkInDate".' AND ' ."$checkOutDate".')' ))
            ->get();

        return $availableRooms;
        //return view('rooms');lorem
    }



}

The problem is I'm getting this error now.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seaurchin.availableroom' doesn't exist (42S02)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire