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
sudo port selfupdate | |
sudo port upgrade outdated | |
sudo port uninstall inactive | |
time sudo port install php71 php71-apache2handler | |
cd /opt/local/apache2/modules | |
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php71.so |
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
SQLSTATE[HY000]: General error: 1111 Invalid use of group function (SQL: select `i`.`id` as `invoice_id`, `i`.`client_id`, `i`.`mod_user_id`, `i`.`invoice_type_id`, `i`.`created_at` as `i_created_at`, `c`.`id` as `client_id`, `c`.`first_name`, `c`.`last_name`, `c`.`company`, `u`.`id` as `user_id`, `u`.`username`, `p`.`id` as `payment_id`, `p`.`paid`, `p`.`created_at` as `p_created_at`, `pt`.`name` as `payment_type`, (SUM(p.amount) - SUM(p.fee)) as p_total, SUM(t.list) as t_list, ((SUM(t.list) + (SUM(d.fee) + SUM(d.additional_cost))) - (SUM(p.amount) - SUM(p.fee))) as balance from `j_invoice` as `i` inner join `j_client` as `c` on `c`.`id` = `i`.`client_id` inner join `j_users` as `u` on `u`.`id` = `i`.`mod_user_id` inner join `j_invoice_payment` as `p` on `p`.`invoice_id` = `i`.`id` inner join `j_payment_type` as `pt` on `pt`.`id` = `p`.`payment_method_id` inner join `j_invoice_ticket` as `it` on `it`.`invoice_id` = `i`.`id` inner join `j_ticket` as `t` on `t`.`id` = `it`.`ticket_id` inner join `j_invoice_del |
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
$query = DB::table('invoice AS i') | |
->join('client AS c', 'c.id', '=', 'i.client_id') | |
->join('users AS u', 'u.id', '=', 'i.mod_user_id') | |
->join('invoice_payment AS p', 'p.invoice_id', '=', 'i.id') | |
->join('payment_type AS pt', 'pt.id', '=', 'p.payment_method_id') | |
->join('invoice_ticket AS it', 'it.invoice_id', '=', 'i.id') | |
->join('ticket AS t', 't.id', '=', 'it.ticket_id') | |
->join('invoice_delivery AS d', 'd.invoice_id', '=', 'i.id') | |
->select(array( | |
'i.id', 'i.client_id', 'i.mod_user_id', 'i.invoice_type_id', |
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
$ticketBalance = DB::table('invoice AS i') | |
->join('invoice_ticket AS it', 'it.invoice_id', '=', 'i.id') | |
->join('ticket AS t', 't.id', '=', 'it.ticket_id') | |
->select(array(DB::raw('SUM(t.cost) as totalTicketsCost'))) | |
->where('i.id', '=', $invoiceId) | |
->first(); |
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 | |
class Ticket extends Eloquent { | |
protected $table = 'ticket'; | |
} |
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 | |
class InvoiceTicket extends Eloquent { | |
protected $table = 'invoice_ticket'; | |
public function getTicket() | |
{ | |
return $this->hasOne('Ticket', 'id', 'ticket_id'); | |
} |
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 | |
class Invoice extends Eloquent { | |
protected $table = 'invoice'; | |
public function getInvoiceTickets() | |
{ | |
return $this->hasMany('InvoiceTicket', 'invoice_id'); | |
} |