Last Updated
Viewed 07 Times

How can I disable Telescope for all Nova related things? With some clicks in Nova, my whole Telescope is full of their requests. I don't care about Nova-requests, but can't figure out how to disable registering those requests.

I got the fallowing date time field:

DateTime
    ::make('foobar')
    ->format('DD-MM-YYYY HH:mm:ss') // https://momentjs.com/docs/#/parsing/string-format/
    ->pickerFormat('d-m-Y H:i:S') // https://flatpickr.js.org/formatting/
    ->rules('required', 'date_format:Y-m-d H:i:s')
    ->firstDayOfWeek(1)

Momentjs does not recognise the date. I get a warning after changing the date in console:

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

It seems like momentjs is not getting the format? But I am clearly setting it in the nova resource and so it should get passed to vue, and so on? right?

Removing ->pickerFormat() allows me to save the date, but without displaying it the way I want in the picker.

I might be doing it completely wrong, so if someone could produce a working example of a DateTime filed with format and pickerFormat then that would be great as well.

edit:

Some more info. I re-transpiled Nova's using dev mode so I could poke around using Vue (chrome extension) tool.

I have also looked at the DateTime (vue) component without success. To bad it is closed source.

This question concerns Laravel Nova 2.5.

I have a User (Nova) resource class that contains a 'file' field. I don't want the file path to be stored in my users DB table, but in a general 'files' DB table.

I found this code snippet in the Laraval Nova documentation that explains how to store the file path in the related table. But I'm not sure how I can set the FK field (file_id) in my users table (As now this field remains NULL, when storing the user resource via Nova). The snippet I found comes from:

https://nova.laravel.com/docs/2.0/resources/file-fields.html#customizing-file-storage

use Illuminate\Http\Request;

File::make('Attachment')
    ->store(function (Request $request, $model) {
        return function () use ($resource, $request) {
            $media = $resource->media()->updateOrCreate([], [
                'path'=> $request->file('attachment')->store('/path', 'public')
        ]);
    };
});

My users table looks like this:

  • id (prim key)
  • file_id (unsigned int)
  • username (varchar: 255)
  • email (varchar: 255)
  • created_at (datetime)
  • updated_at (datetime)

My files table looks like this:

  • id (prim key)
  • original_name (varchar: 255)
  • generated_name (varchar: 255)
  • created_at (datetime)
  • updated_at (datetime)

Thanks.

How to disable edit/delete button on nova index page and still allow in detail page, if I will create a policy, that will disable the operation everywhere, I want to allow edit and delete in detail page, but just want to remove those button from index,

is doing something like

 public function update(User $user, Customer $customer)
    {
        if ( request()->route()->getName('route-name') ) {
            return false;
        }
    }

is correct way or there is any better way?

Similar Question 7 (2 solutions) : Laravel (nova) inheritance mapping

Similar Question 8 (1 solutions) : Laravel Nova Number Format

Similar Question 9 (1 solutions) : Laravel Nova custom login

cc