Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop release 0.6 #30

Merged
merged 8 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Removed --->

## 0.6.0 - 2021-07-14
### Added
- Support for Jetstream/Spark teams
### Fixed
- Model observers - https://github.com/venturedrake/laravel-crm/issues/29
- Assign role instead of sync - https://github.com/venturedrake/laravel-crm/pull/28

## 0.5.1 - 2021-05-31
### Fixed
- Missing key in lang file
Expand Down
38 changes: 11 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This package will add CRM functionality to your laravel projects
- Build a custom CRM for your business or your clients
- Use as an integrated CRM for your Laravel powered business (Saas, E-commerce, etc)
- Use as a CRM for your Laravel development business
- Run a multi-tenant CRM Saas business

## Features

Expand All @@ -27,6 +28,7 @@ This package will add CRM functionality to your laravel projects
- Users & Teams
- Secure registration & login
- Reset forgotten password
- Laravel Jetstream/Spark teams support

## Installation (10-15mins)

Expand All @@ -45,7 +47,7 @@ https://spatie.be/docs/laravel-permission/v4/installation-laravel
#### Step 4. Require the current package using composer:

```bash
composer require venturedrake/laravel-crm:^0.5
composer require venturedrake/laravel-crm:^0.6
```

#### Step 5. Publish the migrations, config & assets
Expand Down Expand Up @@ -127,12 +129,12 @@ Note if you modified the route_prefix setting from the default the above url wil

## Upgrade

### Upgrading from 0.3
### Upgrading from >= 0.2

#### Step 1. Run the following to the update migrations and publish assets:

```bash
composer require venturedrake/laravel-crm::^0.5
composer require venturedrake/laravel-crm::^0.6
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="assets" --force
php artisan migrate
Expand All @@ -144,26 +146,12 @@ php artisan migrate
php artisan db:seed --class="VentureDrake\LaravelCrm\Database\Seeders\LaravelCrmTablesSeeder"
```

### Upgrading from 0.1 to 0.3
### Upgrading from < 0.2

#### Step 1. Run the following to the update migrations and publish assets:
#### Step 1. Run the following to the update package:

```bash
composer require venturedrake/laravel-crm::^0.3
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="assets" --force
php artisan migrate
```

### Upgrading from 0.1 to 0.2

#### Step 1. Run the following to the update package, database and add the default roles/permissions:

```bash
composer require venturedrake/laravel-crm::^0.2
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="migrations"
php artisan migrate
php artisan db:seed --class="VentureDrake\LaravelCrm\Database\Seeders\LaravelCrmTablesSeeder"
composer require venturedrake/laravel-crm::^0.6
```

#### Step 2. Delete previously published package views located in <code>resources/views/vendor/laravel-crm/*</code>
Expand All @@ -172,18 +160,14 @@ php artisan db:seed --class="VentureDrake\LaravelCrm\Database\Seeders\LaravelCrm

#### Step 4. Add HasCrmAccess, HasCrmTeams & HasRoles traits to App\User model, see installation Step 8.

### Upgrading from 0.1.x to 0.1.2

#### Step 1. Run the following to update the package & database

#### Step 5. Run the following to the update database and add the default roles/permissions:
```bash
composer require venturedrake/laravel-crm::^0.1
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="assets" --force
php artisan migrate
php artisan db:seed --class="VentureDrake\LaravelCrm\Database\Seeders\LaravelCrmTablesSeeder"
```

#### Step 2. Delete previously published package views located in folder <code>resources/views/vendor/laravel-crm/*</code>

<!--- ## Usage --->

## Testing
Expand Down
23 changes: 23 additions & 0 deletions config/laravel-crm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@

'crm_owner' => env('LARAVEL_CRM_OWNER', ''),

/*
|--------------------------------------------------------------------------
| Teams Support
|--------------------------------------------------------------------------
|
| This value relates to the "teams" feature in Laravel Jetstream or Spark.
| Only set this to true if you are using this feature as it will break
| your installation if not. It basically allows you to run a multi-tenant
| crm, and the teams can be different "accounts". You can switch between
| different teams/accounts and have different users, contacts, leads, etc
| in each account.
|
| PLEASE NOTE! This has nothing to do with the user teams feature within
| the crm itself, which is simply a way of grouping users within the crm.
|
| For Jetstream see https://jetstream.laravel.com/2.x/features/teams.html
|
| For Spark see https://spark-classic.laravel.com/docs/11.0/teams
|
*/

'teams' => env('LARAVEL_CRM_TEAMS', false),

/*
|--------------------------------------------------------------------------
| Route Prefix
Expand Down
2 changes: 1 addition & 1 deletion config/package.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
|
*/

'version' => '0.5.1',
'version' => '0.6.0',

];
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddGlobalToLaravelCrmSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(config('laravel-crm.db_table_prefix').'settings', function (Blueprint $table) {
$table->boolean('global')->after('team_id')->default(false);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(config('laravel-crm.db_table_prefix').'settings', function (Blueprint $table) {
$table->dropColumn(['global']);
});
}
}
2 changes: 1 addition & 1 deletion resources/views/updates/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="card">
<div class="card-header"><h3 class="card-title m-0">Laravel CRM {{ ucfirst(__('laravel-crm::lang.updates')) }}</h3></div>
<div class="card-body">
<p class="card-text">{{ ucfirst(__('laravel-crm::lang.current_version')) }} {{ \VentureDrake\LaravelCrm\Models\Setting::where('name','version')->first()->value }} {{ (\VentureDrake\LaravelCrm\Models\Setting::where('name','version')->first()->value == \VentureDrake\LaravelCrm\Models\Setting::where('name','version_latest')->first()->value) ? ucfirst(__('laravel-crm::lang.is_the_latest_version')) : null }}</p>
<p class="card-text">{{ ucfirst(__('laravel-crm::lang.current_version')) }} {{ \VentureDrake\LaravelCrm\Models\Setting::where('name','version')->first()->value }} {{ (\VentureDrake\LaravelCrm\Models\Setting::where('name','version')->first()->value == \VentureDrake\LaravelCrm\Models\Setting::where('name','version_latest')->first()->value) ? __('laravel-crm::lang.is_the_latest_version') : null }}</p>
@if(\VentureDrake\LaravelCrm\Models\Setting::where('name','version')->first()->value < \VentureDrake\LaravelCrm\Models\Setting::where('name','version_latest')->first()->value)
<hr />
<h5 class="mb-4">{{ ucfirst(__('laravel-crm::lang.updated_version_of_laravel_crm_is_available')) }}</h5>
Expand Down
7 changes: 7 additions & 0 deletions src/Http/Controllers/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace VentureDrake\LaravelCrm\Http\Controllers;

use DB;
use VentureDrake\LaravelCrm\Http\Requests\UpdateSettingRequest;
use VentureDrake\LaravelCrm\Services\SettingService;

Expand Down Expand Up @@ -51,6 +52,12 @@ public function update(UpdateSettingRequest $request)
$this->settingService->set('country', $request->country);
$this->settingService->set('currency', $request->currency);

if ($request->organisation_name && config('laravel-crm.teams') && auth()->user()->currentTeam) {
DB::table("teams")
->where("id", auth()->user()->currentTeam->id)
->update(["name" => $request->organisation_name]);
}

flash(ucfirst(trans('laravel-crm::lang.settings_updated')))->success()->important();

return back();
Expand Down
26 changes: 14 additions & 12 deletions src/LaravelCrmServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
use VentureDrake\LaravelCrm\Models\Organisation;
use VentureDrake\LaravelCrm\Models\Person;
use VentureDrake\LaravelCrm\Models\Phone;
use VentureDrake\LaravelCrm\Models\Setting;
use VentureDrake\LaravelCrm\Observers\EmailObserver;
use VentureDrake\LaravelCrm\Observers\LeadObserver;
use VentureDrake\LaravelCrm\Observers\OrganisationObserver;
use VentureDrake\LaravelCrm\Observers\PersonObserver;
use VentureDrake\LaravelCrm\Observers\PhoneObserver;
use VentureDrake\LaravelCrm\Observers\SettingObserver;

class LaravelCrmServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -75,6 +77,14 @@ class_alias(config("auth.providers.users.model"), 'App\User');

$this->registerRoutes();

// Register Observers
Lead::observe(LeadObserver::class);
Person::observe(PersonObserver::class);
Organisation::observe(OrganisationObserver::class);
Phone::observe(PhoneObserver::class);
Email::observe(EmailObserver::class);
Setting::observe(SettingObserver::class);

if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/laravel-crm.php' => config_path('laravel-crm.php'),
Expand Down Expand Up @@ -107,6 +117,7 @@ class_alias(config("auth.providers.users.model"), 'App\User');
__DIR__ . '/../database/migrations/create_laravel_crm_product_prices_table.php.stub' => $this->getMigrationFileName($filesystem, 'create_laravel_crm_product_prices_table.php', 8),
__DIR__ . '/../database/migrations/create_laravel_crm_product_variations_table.php.stub' => $this->getMigrationFileName($filesystem, 'create_laravel_crm_product_variations_table.php', 9),
__DIR__ . '/../database/migrations/create_laravel_crm_deal_products_table.php.stub' => $this->getMigrationFileName($filesystem, 'create_laravel_crm_deal_products_table.php', 10),
__DIR__ . '/../database/migrations/add_global_to_laravel_crm_settings_table.php.stub' => $this->getMigrationFileName($filesystem, 'add_global_to_laravel_crm_settings_table.php', 11),
], 'migrations');

// Publishing the seeders
Expand All @@ -127,18 +138,9 @@ class_alias(config("auth.providers.users.model"), 'App\User');
}

// Registering package commands.
if ($this->app->runningInConsole()) {
$this->commands([
LaravelCrmInstall::class,
]);
}

// Register Observers
Lead::observe(LeadObserver::class);
Person::observe(PersonObserver::class);
Organisation::observe(OrganisationObserver::class);
Phone::observe(PhoneObserver::class);
Email::observe(EmailObserver::class);
$this->commands([
LaravelCrmInstall::class,
]);

// Register the model factories
if (app()->version() < 8) {
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;

class Activity extends Model
{
use SoftDeletes;
use BelongsToTeams;

public function getTable()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;
use VentureDrake\LaravelEncryptable\Traits\LaravelEncryptableTrait;

class Address extends Model
{
use SoftDeletes;
use LaravelEncryptableTrait;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
2 changes: 2 additions & 0 deletions src/Models/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;

class CustomField extends Model
{
use SoftDeletes;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
2 changes: 2 additions & 0 deletions src/Models/CustomFieldValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;

class CustomFieldValue extends Model
{
use SoftDeletes;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
2 changes: 2 additions & 0 deletions src/Models/Deal.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;
use VentureDrake\LaravelCrm\Traits\HasCrmFields;

class Deal extends Model
{
use SoftDeletes;
use HasCrmFields;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
2 changes: 2 additions & 0 deletions src/Models/DealProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;

class DealProduct extends Model
{
use SoftDeletes;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
2 changes: 2 additions & 0 deletions src/Models/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;
use VentureDrake\LaravelEncryptable\Traits\LaravelEncryptableTrait;

class Email extends Model
{
use SoftDeletes;
use LaravelEncryptableTrait;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
5 changes: 5 additions & 0 deletions src/Models/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
namespace VentureDrake\LaravelCrm\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;

class Label extends Model
{
use SoftDeletes;
use BelongsToTeams;

protected $guarded = ['id'];

public function getTable()
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Lead.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use VentureDrake\LaravelCrm\Traits\BelongsToTeams;
use VentureDrake\LaravelCrm\Traits\HasCrmFields;

class Lead extends Model
{
use SoftDeletes;
use HasCrmFields;
use BelongsToTeams;

protected $guarded = ['id'];

Expand Down
Loading