2017 © Pedro Peláez
 

library weclapp

Accounting made easy for Laravel

image

geccomedia/weclapp

Accounting made easy for Laravel

  • Tuesday, June 19, 2018
  • by Tamrael
  • Repository
  • 1 Watchers
  • 0 Stars
  • 43 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 23 % Grown

The README.md

Laravel Weclapp

Latest Stable Version Total Downloads License, (*1)

This repo implements most of the Laravel Eloquent Model for the Weclapp web api., (*2)

Installation Informations

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

Usage

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();

Custom models

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';
}

Mass assignments

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();

Sub Entities

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)

Logging

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)

The Versions

19/06 2018

dev-master

9999999-dev

Accounting made easy for Laravel

  Sources   Download

MIT

The Requires

 

by Gecco Media GmbH

laravel accounting