/** * Used with AJAX in the list view (datatables) to show extra information about that row that didn't fit in the table. * It defaults to showing all connected translations and their CRUD buttons. * * It's enabled by: * - setting the $crud['details_row'] variable to true; * - adding the details route for the entity; ex: Route::get('page/{id}/details', 'PageCrudController@showDetailsRow'); */ public function showDetailsRow($id) { // get the info for that entry $model = $this->crud['model']; $this->data['entry'] = $model::find($id); $this->data['entry']->addFakes($this->getFakeColumnsAsArray()); $this->data['original_entry'] = $this->data['entry']; $this->data['crud'] = $this->crud; if (property_exists($model, 'translatable')) { $this->data['translations'] = $this->data['entry']->translations(); // create a list of languages the item is not translated in $this->data['languages'] = \Dick\TranslationManager\Models\Language::all(); $this->data['languages_already_translated_in'] = $this->data['entry']->translationLanguages(); $this->data['languages_to_translate_in'] = $this->data['languages']->diff($this->data['languages_already_translated_in']); $this->data['languages_to_translate_in'] = $this->data['languages_to_translate_in']->reject(function ($item) { return $item->abbr == \Lang::locale(); }); } // load the view from /resources/views/vendor/dick/crud/ if it exists, otherwise load the one in the package return $this->firstViewThatExists('vendor.dick.crud.details_row', 'crud::details_row', $this->data); }