This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BelongsTo::make('Product')->rules('required')->hideWhenCreating()->hideWhenUpdating(), | |
SearchableSelect::make('Product', 'product_id')->resource("products")->loadResourcesOnNew()->displayUsing(function($product) {return $this->product->title ; })->hideFromIndex(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Insert the sum of a column into the columns footer, for the visible | |
// data on each draw | |
// var table = $('#crudTable').DataTable(); | |
// $("#wave_total").html( $('#crudTable').column( 3 ).data().sum()); | |
jQuery(document).ready(function($) { | |
jQuery.fn.dataTable.Api.register( 'sum()', function ( ) { | |
return this.flatten().reduce( function ( a, b ) { | |
if ( typeof a === 'string' ) { | |
a = a.replace(/[^\d.-]/g, '') * 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- DATA TABLES SCRIPT BREIZHWAVE20181009 from https://github.com/Laravel-Backpack/CRUD/issues/1457#issuecomment-404576891 --> | |
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js" type="text/javascript"></script> | |
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js" type="text/javascript"></script> | |
<script src="https://cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js"></script> | |
<script src="https://cdn.datatables.net/responsive/2.2.1/js/responsive.bootstrap.min.js"></script> | |
<script> | |
var crud = { | |
enablePersistance: true, | |
route: 'DataTables_{{ trim($crud->getRoute(), '/') }}', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Admin; | |
use Backpack\CRUD\app\Http\Controllers\CrudController; | |
// VALIDATION: change the requests to match your own file names if you need form validation | |
use App\Http\Requests\WaveResourceRequest as StoreRequest; | |
use App\Http\Requests\WaveResourceRequest as UpdateRequest; | |
class WaveCrudController extends CrudController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Admin; | |
use Backpack\CRUD\app\Http\Controllers\CrudController; | |
// VALIDATION: change the requests to match your own file names if you need form validation | |
use App\Http\Requests\WaveResourceRequest as StoreRequest; | |
use App\Http\Requests\WaveResourceRequest as UpdateRequest; | |
class WaveCrudController extends CrudController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->crud->addField([ // SELECT | |
'label' => 'Category', | |
'type' => 'select2_grouped',//https://github.com/Laravel-Backpack/CRUD/issues/502 | |
'name' => 'category_id', | |
'entity' => 'category', | |
'attribute' => 'name', | |
'model' => "Backpack\NewsCRUD\app\Models\Category", | |
'group_label_attribute' => 'name', | |
'group_entity' => 'Children' | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery( function( $ ) { | |
var gallery_container = $('.gallery_container'); | |
var variations = {}; | |
$('.variations select').each(function(){ | |
if($(this).val() != '') { | |
variations[$(this).attr('id')] = $(this).val(); | |
}}); | |
console.log(count_length(variations)) | |
if( count_length(variations) > 0 ) { // If we have some variation data, show the associated images |