MoonShine позволяет работать привычным образом, используя контроллеры.
Мы предоставляем вам наш базовый контроллер, который помогает удобно работать с UI и отображать ваши представления с макетом MoonShine.
Это полезно для отображения ваших сложных решений или написания дополнительных обработчиков.
Наследовать MoonshineController
не является обязательным, мы всего лишь предоставляем удобные готовые методы.
php artisan moonshine:controller
php artisan moonshine:controller
php artisan moonshine:controller
О всех поддерживаемых опциях можно узнать в разделе Команды.
namespace App\MoonShine\Controllers;
use MoonShine\Contracts\Core\PageContract;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(): PageContract
{
return $this->view(
'path_to_blade',
['param' => 'value']
);
}
}
namespaces
namespace App\MoonShine\Controllers;
use MoonShine\Contracts\Core\PageContract;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(): PageContract
{
return $this->view(
'path_to_blade',
['param' => 'value']
);
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Contracts\Core\PageContract;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(): PageContract
{
return $this->view(
'path_to_blade',
['param' => 'value']
);
}
}
namespace App\MoonShine\Controllers;
use App\MoonShine\Pages\MyPage;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(MyPage $page): MyPage
{
return $page->loaded();
}
}
namespaces
namespace App\MoonShine\Controllers;
use App\MoonShine\Pages\MyPage;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(MyPage $page): MyPage
{
return $page->loaded();
}
}
namespace App\MoonShine\Controllers;
use App\MoonShine\Pages\MyPage;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
final class CustomViewController extends MoonShineController
{
public function __invoke(MyPage $page): MyPage
{
return $page->loaded();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Support\Enums\ToastType;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->toast('Hello world', ToastType::SUCCESS);
return back();
}
}
namespaces
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Support\Enums\ToastType;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->toast('Hello world', ToastType::SUCCESS);
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Support\Enums\ToastType;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->toast('Hello world', ToastType::SUCCESS);
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->notification('Message');
return back();
}
}
namespaces
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->notification('Message');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
$this->notification('Message');
return back();
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Laravel\MoonShineRequest;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(MoonShineRequest $request)
{
}
}
namespaces
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Laravel\MoonShineRequest;
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\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Laravel\MoonShineRequest;
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\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
return $this->json(message: 'Message', data: []);
}
}
namespaces
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
return $this->json(message: 'Message', data: []);
}
}
namespace App\MoonShine\Controllers;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use Symfony\Component\HttpFoundation\Response;
final class CustomViewController extends MoonShineController
{
public function __invoke(): Response
{
return $this->json(message: 'Message', data: []);
}
}