Category : laravel-nova

Good day to all. Hopefully I could get a bit of help with this. It seems that I can’t retrieve user relationship that created the opportunity in the Feedback resource: (the user should be retrieved via opportunity resource / table) I have three tables of interest. **Feedback** id user_id opportunity_id **Opportunity** id created_by **User** id ..

Read more

Good day to all. Hopefully I could get a bit of help with this. It seems that I can’t retrieve user relationship that created the opportunity in the Feedback resource: (the user should be retrieved via opportunity resource / table) I have three tables of interest. **Feedback** id user_id opportunity_id **Opportunity** id created_by **User** id ..

Read more

When using nova fields, I can pass an array of attributes that will appear regarding certain resource so I can view or edit. It mainly goes like this: public function fields(Request $request) { return [ ID::make()->sortable(), Text::make(‘Name’)->rules([ ‘required’, ‘max:255’ ]), BelongsToMany::make(‘Customers’), } The current issue is that I have a rather complex relation that includes ..

Read more

I have the following relations class Customer { public function orders() { return $this->hasMany(‘AppOrder’); } public function marketingDiscountCode() { return $this->belongsToMany(MarketingDiscountCode::class, ‘customer_marketing_discount_code’); } } class MarketingDiscountCode { public function customers() { return $this->belongsToMany(Customer::class, ‘customer_marketing_discount_code’); } } How can I add orders method in MarketingDiscountCode that mainly executes the following the query: select * from `orders` ..

Read more

I’m gonna make a Unit Testing for my resource. Here my testing function below : public function testCreateMyResource() { $user = factory(AppUser::class)->states(‘admin’)->create(); $this->actingAs($user); $data = [ ‘Field’ => "Example", ]; $response = $this->actingAs($user)->postJson(‘/nova-api/my-resource?editing=true&editMode=create’,$data); $response->assertStatus(201); $response->assertJson([‘status’ => true]); $response->assertJson([‘message’ => "Created!"]); } But it was return 403. I expected to return 201 as I login normally ..

Read more

I’m looking for a way to override the cancel and update buttons on a resource. I’m new’ish to Nova. I would like to add a class to the container for the cancel and update actions (see image). So far I can’t figure out how to do that. There doesn’t seem to be any unique class ..

Read more

I have a Filter configured for my Nova Resource. It applies the status: public function apply(Request $request, $query, $value) { return $query->where(‘status’, $value); } This works fine for the Table, but I have some Metrics configured on the Index as well. Is there a way for me the apply the active filter also on the ..

Read more

I use a custom local disk: ‘brand_pdf’ => [ ‘driver’ => ‘local’, ‘root’ => storage_path(‘app/public/brand_pdf’), ‘url’ => env(‘APP_URL’) . ‘/storage/brand_pdf’, ‘visibility’ => ‘public’, ], In the database the file path saved in pdf column, e.g. placeholder.pdf. In the model in fields method: File::make(‘Description’, ‘pdf’)->disk(‘brand_pdf’), I’ve created a symlink by php artisan storage:link. I can upload ..

Read more