i use both laravel 5 and angularjs for my application, also use JWT authentictaion using both Tymon/jwt-auth and Satellizer.
My issue now is i am trying to save some data into my database, in my database i have set the user_id column to NOT NULL.
In my PHP code i have made it so that if the user is not logged in it just saves an ID of 0 instead. However now when i try it even when i am logged in it is still saved as 0. This is my code:
// Saving invoice Details
$invoice->user_id = Auth::check() ? Auth::user()->id : 0; // If user is not logged in value is 0
$invoice->type = $cart['info']['type'];
$invoice->vendor_id = $cart['info']['id'];
$invoice->vendor_name = $cart['info']['name'];
$invoice->reference_code = $reference_code;
$invoice->total_no_of_tickets = $tickets_total_number;
$invoice->total_amount_billed = $calculated_total_cost;
$invoice->total_charges_applied = $charges_total_applied;
$invoice->total_discounts_applied = $discounts_total_applied;
$invoice->save();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire