Change PING route response

This commit is contained in:
David Bomba 2020-07-02 20:14:19 +10:00
parent b37c475414
commit d3775fd059
7 changed files with 219 additions and 248 deletions

View File

@ -23,6 +23,6 @@ class PingController extends BaseController
*/
public function index()
{
return response()->json('success', 200);
return response()->json(['company_name' => auth()->user()->getCompany()->present()->name()], 200);
}
}

View File

@ -294,7 +294,7 @@ class RecurringInvoice extends BaseModel
public function recurringDates()
{
//send back a list of the next send dates and due dates
//todo send back a list of the next send dates and due dates
}
}

View File

@ -73,13 +73,12 @@ class ClientContactRepository extends BaseRepository
//always made sure we have one blank contact to maintain state
if ($client->contacts->count() == 0) {
info("no contacts found");
$new_contact = ClientContactFactory::create($client->company_id, $client->user_id);
$new_contact->client_id = $client->id;
$new_contact->contact_key = Str::random(40);
$new_contact->is_primary = true;
$new_contact->save();
}
}

View File

@ -12,9 +12,11 @@
namespace App\Transformers;
use App\Models\Backup;
use App\Models\Client;
use App\Models\Document;
use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Transformers\ClientTransformer;
use App\Transformers\DocumentTransformer;
use App\Transformers\InvoiceHistoryTransformer;
use App\Transformers\InvoiceInvitationTransformer;
@ -30,10 +32,10 @@ class InvoiceTransformer extends EntityTransformer
];
protected $availableIncludes = [
'invitations',
'history'
// 'invitations',
'history',
// 'payments',
// 'client',
'client',
// 'documents',
];
@ -51,6 +53,13 @@ class InvoiceTransformer extends EntityTransformer
return $this->includeCollection($invoice->history, $transformer, Backup::class);
}
public function includeClient(Invoice $invoice)
{
$transformer = new ClientTransformer($this->serializer);
return $this->includeItem($invoice->client, $transformer, Client::class);
}
/*
public function includePayments(Invoice $invoice)
{
@ -59,12 +68,6 @@ class InvoiceTransformer extends EntityTransformer
return $this->includeCollection($invoice->payments, $transformer, ENTITY_PAYMENT);
}
public function includeClient(Invoice $invoice)
{
$transformer = new ClientTransformer($this->account, $this->serializer);
return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT);
}
public function includeExpenses(Invoice $invoice)
{

View File

@ -55,8 +55,7 @@
"staudenmeir/eloquent-has-many-deep": "^1.11",
"stripe/stripe-php": "^7.0",
"turbo124/beacon": "^1",
"webpatser/laravel-countries": "dev-master#75992ad",
"yajra/laravel-datatables-oracle": "~9.0"
"webpatser/laravel-countries": "dev-master#75992ad"
},
"require-dev": {
"laravelcollective/html": "^6",

432
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::get('/api/v1/ping', 'PingController@index')->name('ping');
Route::group(['middleware' => ['api_secret_check']], function () {
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
@ -23,6 +22,9 @@ Route::group(['api_secret_check', 'email_db'], function () {
});
Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () {
Route::get('ping', 'PingController@index')->name('ping');
Route::resource('activities', 'ActivityController');// name = (clients. index / create / show / update / destroy / edit
Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit