Advance Search in Laravel datatable

Hi,
I'm using Yajra lib with Laravel for datatable,
I want to make popup window as advance search, How can do it with your Metronic Theme

Another thing, how can make advance query from mulit tables in database to show it in on datatable page ,
for example, I have Visa page.. this page get data from multi db table ,
Visa related with (visa_type, customer, branch, sms status , sms counter ) , the sms status is related with ( Sms status, sms message, sms count succes send ..etc) , all this information is shown in on datatable in Visa page...
So, how can using Yajra to manage kind of this detatable query

Hope you guide me
Regards,

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)

Hi,

The relation needs to be done in the Laravel model. For example in Visa model file,

Visa.php modal file;

public function customer()
{
return $this->belongsTo(User::class, 'user_id');
}

In the query function in datatable init file, eg. app/DataTables/VisaDataTable.php

public function query(Visa $model)
{
return $model->newQuery()->with('customer');
}

public function dataTable($query)
{
return datatables()
->eloquent($query)
->editColumn('customer', function (Visa $model) {
// access customer data here for columns
// $model->customer
})
//...


Thanks

Hi,
I try that, But my issue is when I try fetch some data from other tables and some fields still empty not yet have values entered, In Yajra lib show me error and can't get data, also have issue with null data ( can't return null value or treatment with null ), only need all data selected from table is not empty, so how can solving that ??I hope you understand me

Best regards,
M.Fakira

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(