laravel-nova

PHP Laravel options of select not rendering correct values

社会主义新天地 提交于 2019-12-09 04:26:29
I want to display an array of values as options inside a select using the laravel-nova syntax. I managed to get the options rendered inside the select but the values of these options are like <option value="2"></option> <option value="1"></option> <option value="0"></option> what I want is the text as an value. this is what I got so far: Select::make('Slug')->options( $this->selectOptions() ) public function selectOptions() { $urls = DB::table('subpages'); $slugs = $urls->pluck('slug'); return $slugs; } What am I doing wrong? Make sure to get() the subpages as Illuminate\Support\Collection and

PHP Laravel options of select not rendering correct values

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:12:17
问题 I want to display an array of values as options inside a select using the laravel-nova syntax. I managed to get the options rendered inside the select but the values of these options are like <option value="2"></option> <option value="1"></option> <option value="0"></option> what I want is the text as an value. this is what I got so far: Select::make('Slug')->options( $this->selectOptions() ) public function selectOptions() { $urls = DB::table('subpages'); $slugs = $urls->pluck('slug');

How do you use confirm dialogues in a custom Laravel Nova tool?

☆樱花仙子☆ 提交于 2019-12-03 23:22:08
Is it possible to use the built in Laravel Nova confirm dialogue in your own tool? All I would like to use is interact with it how Nova does itself. The docs are quite light on the JS topic, as the only built in UI you seem to be able to work with is the toasted plugin: https://nova.laravel.com/docs/1.0/customization/frontend.html#javascript You can use <modal> component whenever you want. Here is how it work internally in Nova: https://gist.github.com/sanasol/fa7441ceb4da9c6c71f9586ec1d04a5a Here is simplified example: https://gist.github.com/sanasol/b3790b8041fb2dfaa0a5b921ff46f5f3 来源: https

how to login using username instead of email in laravel nova?

 ̄綄美尐妖づ 提交于 2019-12-01 08:30:20
问题 In my existing laravel project, I handle logins with a username. I've already replaced email with username on app\Nova\User.php please help me how can I do login with username in laravel nova. Thanks in advance. 回答1: After study about this issue, I've solved my own question. here's the way I go. app\Provider\NovaServiceProvider.php use Illuminate\Support\Facades\Route; //..... protected function routes() { $this->myLoginRoutes(); Nova::routes() // ->withAuthenticationRoutes() -

Laravel Nova - Reorder left navigation menu items

坚强是说给别人听的谎言 提交于 2019-12-01 05:19:38
问题 In default the ordering of left menu items is in alphabetical order. My client wants to order those menus manually. Any idea how to make it possible? 回答1: You can do it in App\Providers\NovaServiceProvider.php add a method resources() and register the resources manually like protected function resources() { Nova::resources([ User::class, Post::class, ]); } 回答2: you can use grouping if that helps. I know it's not a 100% fix but maybe it will help a bit. public static $group = 'Admin'; 来源:

Laravel Nova Redirect to a custom path after login

≯℡__Kan透↙ 提交于 2019-11-30 09:37:26
问题 I need to redirect user after login to a different place according to its role. The logic is simple. I tried to put it in redirectPath() function in Nova LoginController.php , but I have a very wired behavior - sometimes after login I reach the right place, sometimes Nova redirects me to panel. Any idea? 回答1: After a couple of hours of investigation, I figured out that the solution is quite simple. All I had to do is to add the following function to nova LoginController: protected function