Closed BenySLO closed 5 years ago
Resource: NovaBelongsToDepend::make('Chronometry Power Tow', 'chronometryPower', Chronometry::class) ->options(\App\Chronometry::filterChronometry(18))->nullable(), Model: public static function filterChronometry($category) { $get_chronometry_category = Chronometry::all() ->where('section_id', '=', $category); $chronometries = []; foreach ($get_chronometry_category as $each_chronometry) { $chronometries[] = $each_chronometry; } return $chronometries; }
NovaBelongsToDepend::make('Chronometry Power Tow', 'chronometryPower', Chronometry::class) ->options(\App\Chronometry::filterChronometry(18))->nullable(),
public static function filterChronometry($category) { $get_chronometry_category = Chronometry::all() ->where('section_id', '=', $category); $chronometries = []; foreach ($get_chronometry_category as $each_chronometry) { $chronometries[] = $each_chronometry; } return $chronometries; }
So i am running this in model to populate my field, but I dont know how to allow a nullable value. if i push $chronometries[]=[]; it does not work
I will close this issue since i've probably misunderstood our code and the error occurred on saving. And now I'm using my own Select field which I custom populate.
Resource:
NovaBelongsToDepend::make('Chronometry Power Tow', 'chronometryPower', Chronometry::class) ->options(\App\Chronometry::filterChronometry(18))->nullable(),
Model:public static function filterChronometry($category) { $get_chronometry_category = Chronometry::all() ->where('section_id', '=', $category); $chronometries = []; foreach ($get_chronometry_category as $each_chronometry) { $chronometries[] = $each_chronometry; } return $chronometries; }
So i am running this in model to populate my field, but I dont know how to allow a nullable value. if i push $chronometries[]=[]; it does not work