MoonShine allows you to work in a familiar manner using controllers
We provide you with our basic controller, which helps you conveniently work with the UI and render your views with MoonShine layout
Useful for displaying your complex solutions or writing additional handlers
php artisan moonshine:controller
php artisan moonshine:controller
php artisan moonshine:controller
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Illuminate\Contracts\View\View;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): View
{
return $this
->view('path_to_blade', ['param' => 'value'])
->render();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Illuminate\Contracts\View\View;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): View
{
return $this
->view('path_to_blade', ['param' => 'value'])
//->setLayout('custom_layout')
->render();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Illuminate\Contracts\View\View;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): View
{
return $this
->view('path_to_blade', ['param' => 'value'])
//->setLayout('custom_layout')
->render();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use MoonShine\Pages\Page;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Page
{
return MyPage::make();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use MoonShine\Pages\Page;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Page
{
return MyPage::make();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use MoonShine\Pages\Page;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Page
{
return MyPage::make();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->toast('Hello world');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->toast('Hello world');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->toast('Hello world');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->notification('Message');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->notification('Message');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
$this->notification('Message');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request)
{
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request)
{
// $request->getPage();
// $request->getResource();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request)
{
// $request->getPage();
// $request->getResource();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
return $this->json(message: 'Message', data: [], redirect: null);
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
return $this->json(message: 'Message', data: [], redirect: null);
}
}
namespace App\MoonShine\Controllers;
use MoonShine\MoonShineRequest;
use MoonShine\Http\Controllers\MoonshineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonshineController
{
public function __invoke(MoonShineRequest $request): Response
{
return $this->json(message: 'Message', data: [], redirect: null);
}
}