backpack-for-laravel

Including list view of relationship entity on update page

旧时模样 提交于 2019-12-11 18:46:56
问题 I am trying to extend an update view to include a list view of some related items below the edit form. I have two models, Publishers and Volumes, which have a many to many relationship. What I am trying to do is this.... when a user clicks on the edit button for a publisher, I want them to go to a page with the standard edit fields, but also have a list view below the form that lists all of the volumes that are connected to that publisher via their relationship. Is there an easy way to do

How do I specify an IN clause in laravel backpack?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 17:16:07
问题 How do I add an IN clause in laravel with backpack? This is what I am looking for: $this->crud->addClause('where', 'customer_id', 'in', [1,3,5,6,7]);` Should translate into something like this: select * from customer where customer_id in (1,3,5,6,7); 回答1: Just use whereIn instead of where , backpack-for-laravel is ready for that: $this->crud->addClause('whereIn', 'customer_id', [1,3,5,6,7]); 回答2: select * from customer whereIn (customer_id ,$array); 来源: https://stackoverflow.com/questions

how to change the color of each crud entry when ajax table is enabled?

社会主义新天地 提交于 2019-12-11 07:26:25
问题 I am using laravel backpack and recently enabled $this->crud->enableAjaxTable(); in my crud because there was a lot of data to show. But now I am not able to color my crud entries depending upon a expiry_date as I was doing before by overriding list.blade.php like this: @if (!$crud->ajaxTable()) @foreach ($entries as $k => $entry) <?php use Carbon\Carbon; $today_date = Carbon::now(); $data_difference = $today_date->diffInDays(Carbon::parse($entry->expiry_date), false); if($data_difference <=

In Laravel Backpack - Column data in view details and XLS download is truncated

泄露秘密 提交于 2019-12-11 06:37:28
问题 If the column data has approximately more than 50 characters the column gets truncated at around 50. addColumn function has 'type' => 'text' In the end there is [...] This is both in the details pop-up and XLS download. Question is, can this limit be increased from any configuration? 回答1: Yes, you can! There is a limit option on the column for that. $this->crud->addColumns([ [ 'name' => 'name', 'label' => 'Name', 'type' => 'text', 'limit' => 150, ], ... ]); 来源: https://stackoverflow.com

Checkbox not working laravel backpack CRUD

十年热恋 提交于 2019-12-10 11:58:07
问题 $this->crud->addField([ 'name' => 'status', 'label' => 'Featured item', 'type' => 'checkbox', ]); The generated code is following: <div class="form-group col-md-12"> <div class="checkbox"> <label> <input type="hidden" value="0" name="status"> <input type="checkbox" name="status" value="1"> Featured item </label> </div> </div> Using the above code for checkbox, Everything works fine, value is saving correctly in database and fetched correctly. But checkbox is not checked. 来源: https:/

Override CRUD views

随声附和 提交于 2019-12-03 15:18:04
I would like to override the CRUD views of the Laravel Backpack CRUD package, because I want to make small changes to the layout. But obviously I don't want to change the CRUD package itself. Is there an elegant to do this? tabacitu Before loading any views, Backpack for Laravel checks your resources/views/vendor/backpack/crud folder to see if you have any custom views. If you don't, it will just load the views in the package. If you want to overwrite a blade file for all CRUDS , you can just place a file with the right name in the right folder. Take a look at how the files are organized in