Suggest edit

There is usually no need to create custom controllers to do anything outside the package’s scope since you can place your views on the screen, no matter how complex they are.

But if, for example, you already have an implementation of the admin panel and you already have many of your controllers, then rewriting the working code is not at all necessary. By following the steps below, you will understand how to show them in the Orchid interface. Ultimately, this will shorten the transition time and allow you to upgrade in small increments.

To create a new controller, use the make:controller Artisan command:

php artisan make:controller OrchidController

This will generate a new class in the app/Http/Controllers directory. You can then modify the class as needed:

namespace App\Http\Controllers;

class OrchidController extends Controller
     * @return \Illuminate\View\View
    public function index()
        return view('custom');

The index method of your controller should return a view template, which will be rendered using the Orchid package’s style. Here is an example of a view template:


@section('description', 'description')

    <div class="text-center">

    <div class="text-center mt-5 mb-5">

To make the controller accessible through the Orchid interface, you need to declare a route for it in the route file (e.g. routes/platform). This will ensure that common rules such as authorization apply to the controller.

Here is an example of how to declare a route for the OrchidController:

use App\Http\Controllers\OrchidController;

Route::get('custom', [OrchidController::class, 'index']);

You can now access your custom controller by visiting the custom route in your Orchid app.

Our Friends