use App\Nova\Article; use App\Nova\User; use NovaButtonField\Button; Nova::resources([ Article::class, User::class, ]); class Article extends Resource { // ... public function fields(Request $request) { return [ ID::make()->sortable(), Text::make('Title')->sortable(), Trix::make('Content')->hideFromIndex(), BelongsTo::make('User')->searchable(), Button::make('Publish')->click('publishAction')->onlyOnForms(), DateTime::make('Published At'), // ... ]; } public function publishAction() { $this->published_at = now(); $this->save(); return Action::message('Article Published!'); } }
$args = array( 'post_type' => 'post', ); $context = Timber::get_context(); $context['posts'] = Timber::get_posts($args); Timber::render('archive.twig', $context);In both examples, the package library (Laravel Nova and Timber) is clear from the code itself.