forked from Bottelet/DaybydayCRM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bottelet
committed
Jul 13, 2016
0 parents
commit 252a313
Showing
289 changed files
with
67,140 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
APP_ENV=local | ||
APP_DEBUG=true | ||
APP_KEY=i53weLzCSdunQzNc2SXR2AE9XJVDuNaq | ||
|
||
DB_HOST=localhost | ||
DB_DATABASE=database | ||
DB_USERNAME=username | ||
DB_PASSWORD=password | ||
|
||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
QUEUE_DRIVER=sync | ||
|
||
REDIS_HOST=localhost | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.less linguist-vendored | ||
*.rb linguist-language=Php |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/vendor | ||
/node_modules | ||
Homestead.yaml | ||
Homestead.json | ||
.env | ||
bower_components |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Activity extends model | ||
{ | ||
/** | ||
* The database table used by the model. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'activity_log'; | ||
protected $fillable = [ | ||
'user_id', | ||
'text', | ||
'type', | ||
'type_id' | ||
]; | ||
protected $guarded = ['id']; | ||
|
||
/** | ||
* Get the user that the activity belongs to. | ||
* | ||
* @return object | ||
*/ | ||
public function task() | ||
{ | ||
return $this->belongsTo('App\Tasks', 'task_id', 'id'); | ||
} | ||
public function user() | ||
{ | ||
return $this->belongsTo('App\User', 'user_id', '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Carbon; | ||
class Billy { | ||
protected static $accessToken; | ||
protected static $instance; | ||
|
||
public static function initialize($dbRow){ | ||
self::$accessToken = $dbRow['api_key']; | ||
self::$instance = new Billy(); | ||
} | ||
|
||
public static function getInstance(){ | ||
if (!self::$instance){ | ||
self::$instance = new self(); | ||
} | ||
return self::$instance; | ||
} | ||
|
||
public static function request($method, $url, $body = null) { | ||
$headers = array("X-Access-Token: " . self::$accessToken); | ||
$c = curl_init("https://api.billysbilling.com/v2" . $url); | ||
curl_setopt($c, CURLOPT_CUSTOMREQUEST, $method); | ||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
if ($body) { | ||
curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($body)); | ||
$headers[] = "Content-Type: application/json"; | ||
} | ||
curl_setopt($c, CURLOPT_HTTPHEADER, $headers); | ||
$res = curl_exec($c); | ||
$body = json_decode($res); | ||
$info = curl_getinfo($c); | ||
return (object)array( | ||
'status' => $info['http_code'], | ||
'body' => $body | ||
); | ||
|
||
|
||
} | ||
|
||
public static function createInvoice($params) { | ||
|
||
$realParams = array( | ||
'invoice' => array( | ||
'organizationId' =>'ACx42GkURdCdQFFweX7VDQ', | ||
'contactId' => $params['contactId'], | ||
'paymentTermsDays' => 8, | ||
'currencyId' => $params['Currency'], | ||
'entryDate' => Carbon::now()->format('Y-m-d'), | ||
'lines' => array(/*[ | ||
'unitPrice' => 200, | ||
'productId' => 'Ccx9WbbORtGTQtRX48Sdtg', | ||
'description' => $params['ProductLines']['Description'] | ||
]*/) | ||
) | ||
); | ||
foreach ($params['ProductLines'] as $productLine){ | ||
$realParams['invoice']['lines'][] = array( | ||
'unitPrice' => $productLine['BaseAmountValue'], | ||
'productId' => 'Ccx9WbbORtGTQtRX48Sdtg', | ||
'description' => $productLine['Description'] | ||
); | ||
} | ||
|
||
$res = self::request("POST", "/invoices",$realParams); | ||
|
||
return $res; | ||
} | ||
|
||
public function getContacts() | ||
{ | ||
|
||
$res = self::request("GET", "/contacts"); | ||
|
||
$results = []; | ||
$i = 0; | ||
foreach ($res->body->contacts as $contact ) | ||
{ | ||
$results[$i]['name'] = $contact->name; | ||
$results[$i]['guid'] = $contact->id; | ||
$i++; | ||
} | ||
|
||
return $results; | ||
|
||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Client extends Model { | ||
|
||
protected $fillable = [ | ||
'name', | ||
'company_name', | ||
'vat', | ||
'email', | ||
'address', | ||
'zipcode', | ||
'city', | ||
'primary_number', | ||
'secondary_number', | ||
'industry_id', | ||
'company_type', | ||
'fk_user_id']; | ||
|
||
public function userAssignee() { | ||
return $this->belongsTo('App\User', 'fk_user_id', 'id'); | ||
} | ||
|
||
public function alltasks() | ||
{ | ||
return $this->hasMany('App\Tasks', 'fk_client_id', 'id')->orderBy('status' , 'asc')->orderBy('created_at' , 'desc'); | ||
} | ||
public function allleads() | ||
{ | ||
return $this->hasMany('App\Leads', 'fk_client_id', 'id')->orderBy('status' , 'asc')->orderBy('created_at' , 'desc'); | ||
} | ||
|
||
public function tasks() | ||
{ | ||
return $this->hasMany('App\Tasks', 'fk_client_id', 'id'); | ||
} | ||
public function leads() | ||
{ | ||
return $this->hasMany('App\Leads', 'fk_client_id', 'id'); | ||
} | ||
public function documents() | ||
{ | ||
return $this->hasMany('App\Document', 'fk_client_id', '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Comment extends Model { | ||
protected $fillable = [ | ||
'description', | ||
'fk_task_id', | ||
'fk_user_id' | ||
]; | ||
protected $hidden = ['remember_token']; | ||
public function task() | ||
{ | ||
return $this->belongsTo('App\Tasks', 'fk_task_id', 'id'); | ||
} | ||
public function user() | ||
{ | ||
return $this->belongsTo('App\User', 'fk_user_id', '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Foundation\Inspiring; | ||
|
||
class Inspire extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'inspire'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Display an inspiring quote'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
Commands\Inspire::class, | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
$schedule->command('inspire') | ||
->hourly(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Department extends Model | ||
{ | ||
|
||
protected $fillable = | ||
[ | ||
'name', | ||
'description' | ||
]; | ||
} |
Oops, something went wrong.