dev-master
9999999-devAccounting made easy for Laravel
MIT
The Requires
by Gecco Media GmbH
laravel accounting
Wallogit.com
2017 © Pedro Peláez
Accounting made easy for Laravel
This repo implements most of the Laravel Eloquent Model for the Weclapp web api., (*2)
Require this package with Composer, (*3)
composer require geccomedia/weclapp
Add the variables to your .env, (*4)
WECLAPP_BASE_URL=https://#your-sub-domain#.weclapp.com/webapp/api/v1/ WECLAPP_API_KEY=your-key
Use existing models from "Geccomedia\Weclapp\Models"-Namespace., (*5)
Most Eloquent methods are implemented within the limitations of the web api., (*6)
<?php
use Geccomedia\Weclapp\Models\Customer;
class YourClass
{
public function yourFunction()
{
$customer = Customer::where('company', 'Your Company Name')
->firstOrFail();
Example:, (*7)
<?php namespace Your\Custom\Namespace;
use Geccomedia\Weclapp\Model;
class CustomModel extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'custom-api-route';
}
If you want to do mass assignment please use unguard and reguard, (*8)
Example:, (*9)
$customer = new \Geccomedia\Weclapp\Models\Customer(); \Geccomedia\Weclapp\Models\Customer::unguard(); $customer->fill(['partyType' => 'ORGANIZATION']); \Geccomedia\Weclapp\Models\Customer::reguard();
Weclapp api has some models it views as sub entities to other entities. For those cases we need to supply the main entity for the query with whereEntity($name, $id), (*10)
Example:, (*11)
$comments = Comment::whereEntity('customer', 123)->orderByDesc()->get();
Without the call to "whereEntity" the api would complain that we are missing fields. See #22 for more information., (*12)
If you want to see the requests being made, you can use the Connections log, (*13)
Example:, (*14)
use Geccomedia\Weclapp\Connection; app(Connection::class)->enableQueryLog(); \Geccomedia\Weclapp\Models\Customer::create(['name' => 'Test']) app(Connection::class)->getQueryLog();
Copyright (c) 2017 Gecco Media GmbH, (*15)
License, (*16)
Accounting made easy for Laravel
MIT
laravel accounting