Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82115

Editor alias for same table name?

$
0
0

I have this code in editor:

the problem is that it says i have same name for 'zcv_orders_details.data', can i set an alias or something?

Field::inst( 'zcv_orders_details.data' )->getFormatter( function ( $val, $data ) { return date( 'H:i d-m-Y', $val);})

Field::inst( 'zcv_orders_details.data' )->getFormatter( function ( $val, $data ) { return date( 'd-m-Y', $val);})

Full code:

// Build our Editor instance and process the data coming from _POST
$editor = Editor::inst( $db, 'zcv_orders_details', 'zcv_orders_details.id' )
    ->fields(
        Field::inst( 'zcv_orders_details.id' ),
        Field::inst( 'zcv_clients.firstname' ) ->validator( 'Validate::notEmpty' ),
        Field::inst( 'zcv_clients.lastname' ) ->validator( 'Validate::notEmpty' ),
        Field::inst( 'zcv_orders_details.data' )->getFormatter( function ( $val, $data ) { return date( 'H:i d-m-Y', $val);})
        Field::inst( 'zcv_orders_details.data' )->getFormatter( function ( $val, $data ) { return date( 'd-m-Y', $val);})
    )

     ->leftJoin( 'zcv_clients', 'zcv_clients.id', '=', 'zcv_orders_details.clients' );


     if(isset($_POST['year'])){
     $editor->where( 'FROM_UNIXTIME(zcv_orders_details.data, "%Y")', $_POST['year']);

     }
     if(isset($_POST['month'])){
    $editor->where( 'FROM_UNIXTIME(zcv_orders_details.data, "%c")', $_POST['month']);

     }
     if(isset($_POST['sala'])){
    $editor->where( 'zcv_orders_details.gyms', $_POST['sala']);

     }

     $editor
    ->process( $_POST )
    ->json();

Any idea is really apreciates.


Viewing all articles
Browse latest Browse all 82115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>