Progress Report - October 2023

Happy to report that we've launched two new features this month. Both features make it dead-simple to do stuff that is more complex, bu...

Cristian Tabacitu
Cristian Tabacitu
Share:

Happy to report that we've launched two new features this month. Both features make it dead-simple to do stuff that is more complex, but pretty common. We're working hard to make both your DX and the UX better - more info 👇

Maintenance

  • CRUD - 6 bug fixes
  • PRO - 6 bug fixes
  • DevTools - new release 🎉
  • a few small fixes to our other packages

DevTools gets Livewire v3 support

This month, Pedro & Antonio have finished rewriting DevTools to use Livewire v3. It doesn't matter if your project is using Livewire v2 or v3 - you can now install DevTools on top of it, to help you generate migrations, Models, Requests, CRUDs etc 💪 Purchase & install DevTools here.

New Features

New way to customize access - closures

Ever needed to enable/disable an operation... but just for one user type? Or just if that entry has a condition? That was possible, but cumbersome before... you had to override the buttons etc. But now... now it's dead-simple - take a look at this:

$this->crud->setAccessCondition('update', function ($entry) {
    return $entry->created_by === backpack_user()->id;
});

Put the code above in your ProductCrudController::setup(), and it will only give access to update if the entry was created by the current user:

  • you created the entry - you can edit it;
  • you have NOT created the entry - you will NOT see the Update button and you can NOT access the edit() and update() methods on the controller;

This opens up so many possibilities, with one simple command. You can read more about it and see more examples in our docs.

New attribute for columns: linkTo()

As I write this, Pedro is finishing the docs for this cool new attribute. What does it do? It makes one common thing very very easy. Previously, to have a column linked to a route, you had to manually set the wrapper['href'] on it:

CRUD::column('category')->wrapper([
    'href' => function ($crud, $column, $entry, $related_key) {
          return route('category.show', $related_key);
      },
]);

We found that we had to do that very very often, and it's a lot of code to write, very verbose. So... we've made it a lot simpler. You can still change the wrapper[href] manually like above, but now you can also do this:

CRUD::column('category')->linkTo('category.show');

And it'll do the exact same thing. Backpack will even detect that your named route requires a parameter, and feed the related entry id to that parameter 🤯 Crazy-easy, I know. But you can also:

// pass additional parameters to your urls
CRUD::column('my_column')->linkTo('my.route.name', ['myParameter' => 'value']);

// pass a closure instead of a route name
CRUD::column('category')->linkTo(fn($entry, $related_key) => backpack_url('category/'.$related_key.'/show'));

For more information, check out the docs for the linkTo() column attribute. We're very proud of this, because it makes one important thing easier... deep linking your admin panel. Please read more about it below.

Deep linking, easier than ever

While the feature above seems small, it's a HUGE step in making it dead-simple for you, as a developer, to "deep link you admin panel". In the context of admin panels, deep linking is very simple - just have links in your List and Show operations, whenever you mention a related entry. For example, in a blog:

  • Article - has one Category and multiple Tag
  • Category - has multiple Article
  • Tag - has multiple Article

If they don't link to one-another, the admin will always have to go to the Article CRUD, see the Category for a particular article, then go to the Category CRUD and search for that category name. That's a bad UX. If everything links to everything else... the admin will just jump to the page they need, intuitively.

We'll talk more about this in the future, but for now, we heavily recommend that you:

  • have CRUDs for all your Eloquent models;
  • use the ShowOperation on all CRUDs;
  • add links to any relationship columns you have (much easier now with linkTo());
  • inside the ShowOperation, add columns for all the relationships - for example, the Article should have a link to its Category but also the Category should link to all its Article;

Deep link your admin panel! You'll get a huge UX improvement, with just a few minutes for coding. Trust us, your admins will love you for it!

Our Twitter is more active than ever

Karan has been doing a great job of keeping our Twitter engaging. We're regularly posting tips & tricks about Laravel, Backpack and PHP, but also announcements. We've started late, but we're growing steadily, we're now at ~1800 followers 💪 If you use Twitter/X, follow @laravelbackpack - help us get to 2000 🙏


That's it from us. In November we plan to take this even further... code a few more features we think you'll love... and make some optimizations in the way we work. We also have something pretty cool planned for the end of the month 👀 Stay tuned!

Thanks for using Backpack. We love doing this for you. Cheers!

Want to receive more articles like this?

Subscribe to our "Article Digest". We'll send you a list of the new articles, every week, month or quarter - your choice.

Reactions & Comments

What do you think about this?

Latest Articles

Wondering what our community has been up to?