A
A
Alexander2017-02-05 14:37:53
Laravel
Alexander, 2017-02-05 14:37:53

Why is the view not showing in Laravel?

Route:

Route::post('clients/registration', '[email protected]');

Controller
class ClientController extends Controller
{
    function findAction(Request $request)
    {
        if($request['action'] == 'searchFlights') $this->searchFlights($request);
        if($request['action'] == 'informationFlight') $this->informationFlight($request['id']);
        if($request['action'] == 'registrationClient') $this->registrationClient($request);
    }

    function searchFlights(Request $request)
    {
        if($request['departure'] == '') $request['departure'] = '%';
        if($request['arrival'] == '') $request['arrival'] = '%';
        if($request['departure_date'] == '') $request['departure_date'] = '%';

        $serchResults = DB::table('flight')
            ->where('departure', 'LIKE', $request['departure'])
            ->where('arrival', 'LIKE', $request['arrival'])
            ->where('departure_date', 'LIKE', $request['departure_date'])
            ->get();

        return \View::make('pages.clients.registration', ['searchResults' => $serchResults, 'searchValue' => $request]);
    }

    function informationFlight($id)
    {
        $informationFlight = DB::table('flight')
            ->where('id', '=', $id)
            ->get();

        return \View::make('pages.clients.registration', ['informationFlight' => $informationFlight, 'registrationFlag' => true]);
    }

    function registrationClient()
    {

    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mysterion, 2017-02-05
@Mysterion

Probably because $request['action'] is empty when visiting the clients/registration page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question