### Run the Installer Source: https://laravelcrm.com/docs/2.x/installation Execute the installer to publish assets, run migrations, and seed the database. ```bash php artisan laravelcrm:install ``` -------------------------------- ### Configure User Model with Traits Source: https://laravelcrm.com/docs/2.x/users Full setup example for the User model including CRM access, team membership, and role traits. ```php namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Spatie\Permission\Traits\HasRoles; use VentureDrake\LaravelCrm\Traits\HasCrmAccess; use VentureDrake\LaravelCrm\Traits\HasCrmTeams; class User extends Authenticatable { use HasRoles; use HasCrmAccess; use HasCrmTeams; } ``` -------------------------------- ### Install project dependencies Source: https://laravelcrm.com/docs/2.x/contributing Run these commands to install the necessary PHP and Node.js dependencies for the project. ```bash composer install npm install ``` -------------------------------- ### Non-interactive Installer Options Source: https://laravelcrm.com/docs/2.x/installation Pre-select modules during installation for non-interactive environments. ```bash # Enable everything php artisan laravelcrm:install --modules=all # Enable a specific subset php artisan laravelcrm:install --modules=leads,deals,quotes,invoices ``` -------------------------------- ### Require the Package Source: https://laravelcrm.com/docs/2.x/installation Install the package via Composer. ```bash composer require venturedrake/laravel-crm ``` -------------------------------- ### Additional Setup Commands Source: https://laravelcrm.com/docs/2.x/installation Optional commands for managing users and generating development data. ```bash # Add another user with CRM access php artisan laravelcrm:add-user # Generate sample data for development php artisan laravelcrm:sample-data ``` -------------------------------- ### Run Laravel CRM installer Source: https://laravelcrm.com/docs Execute the installer to publish assets, run migrations, and seed the database. ```bash php artisan laravelcrm:install ``` ```bash # Enable everything php artisan laravelcrm:install --modules=all # Enable a specific subset php artisan laravelcrm:install --modules=leads,deals,quotes,invoices ``` -------------------------------- ### Run v2 Migration Helper Source: https://laravelcrm.com/docs/2.x/upgrading Execute this command once after migrating from a 1.x installation to backfill columns and seed lookup tables. ```bash php artisan laravelcrm:v2 ``` -------------------------------- ### Lead API Operations with cURL Source: https://laravelcrm.com/docs/2.x/api-leads Examples for creating a new lead and listing leads with filtering and sorting parameters. ```bash TOKEN="1|abcdef..." # Create curl -s -X POST https://example.test/crm/api/v2/leads \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "New enterprise lead", "amount": 12500.00, "currency": "USD", "expected_close": "2026-09-30T00:00:00Z" }' | jq . # List, newest first, filtered by owner curl -s "https://example.test/crm/api/v2/leads?sort=-created_at&user_owner_id=1" \ -H "Authorization: Bearer $TOKEN" \ -H "Accept: application/json" | jq . ``` -------------------------------- ### Create a New Lead Source: https://laravelcrm.com/docs/2.x/leads Example of creating a new Lead record using the Eloquent create method. ```php use VentureDrake\LaravelCrm\Models\Lead; $lead = Lead::create([ 'title' => 'New website project', 'amount' => 5000, // Stored as 500000 (cents) 'currency' => 'USD', 'description' => 'Potential website redesign project', 'person_id' => $person->id, 'organisation_id' => $organisation->id, 'lead_source_id' => $source->id, 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### GET /crm/api/v2/leads Source: https://laravelcrm.com/docs/2.x/api Lists all leads for the authenticated user. ```APIDOC ## GET /crm/api/v2/leads ### Description Lists all leads for the authenticated user. ### Method GET ### Endpoint /crm/api/v2/leads ``` -------------------------------- ### GET /crm/api/v2/products Source: https://laravelcrm.com/docs/2.x/api-products Retrieve a paginated list of products. ```APIDOC ## GET /crm/api/v2/products ### Description List all products in the system. Results are paginated. ### Method GET ### Endpoint /crm/api/v2/products ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, name, code). Prefix with '-' for descending order. - **user_owner_id** (integer) - Optional - Filter by owner user ID. - **active** (boolean) - Optional - Filter by active status (true/false). ``` -------------------------------- ### GET /crm/api/v2/products/{uuid} Source: https://laravelcrm.com/docs/2.x/api-products Retrieve details for a specific product. ```APIDOC ## GET /crm/api/v2/products/{uuid} ### Description Retrieve the details of a specific product by its UUID. ### Method GET ### Endpoint /crm/api/v2/products/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the product. ``` -------------------------------- ### GET /crm/api/v2/deals Source: https://laravelcrm.com/docs/2.x/api-deals List all deals with pagination and filtering options. ```APIDOC ## GET /crm/api/v2/deals ### Description Retrieve a paginated list of deals. ### Method GET ### Endpoint /crm/api/v2/deals ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, title, amount). Prefix with '-' for descending order. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### GET /crm/api/v2/leads Source: https://laravelcrm.com/docs/2.x/api-leads List leads with support for pagination, sorting, and filtering by owner. ```APIDOC ## GET /crm/api/v2/leads ### Description Retrieve a paginated list of leads. Results can be sorted and filtered by owner. ### Method GET ### Endpoint /crm/api/v2/leads ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, title, amount). Prefix with '-' for descending order. Default is -created_at. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### Publish Assets and Run Migrations Source: https://laravelcrm.com/docs/2.x/upgrading Publish the package configuration, migrations, and assets, then run the database migrations. ```bash php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="migrations" php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="config" php artisan vendor:publish --provider="VentureDrake\LaravelCrm\LaravelCrmServiceProvider" --tag="assets" --force php artisan migrate ``` -------------------------------- ### Create a new product Source: https://laravelcrm.com/docs/2.x/products Demonstrates creating a product record and associating a price in a specific currency. ```php use VentureDrake\LaravelCrm\Models\Product; $product = Product::create([ 'name' => 'Web Design Package', 'code' => 'WDP-001', 'description' => 'Full website design package', 'unit' => 'each', 'active' => true, 'user_owner_id' => auth()->id(), ]); // Add a price $product->productPrices()->create([ 'unit_price' => 5000, // in cents 'currency' => 'USD', ]); ``` -------------------------------- ### Create and Attach Labels Source: https://laravelcrm.com/docs/2.x/labels Demonstrates how to instantiate a new label and associate it with a lead entity. ```php use VentureDrake\LaravelCrm\Models\Label; // Create a label $label = Label::create([ 'name' => 'Hot Lead', 'hex' => 'ff0000', // Stored as #ff0000 'color' => 'red', ]); // Attach a label to a lead $lead->labels()->attach($label->id); // Get all leads with a label $hotLeads = $label->leads; ``` -------------------------------- ### GET /crm/api/v2/auth/me Source: https://laravelcrm.com/docs/2.x/api Returns the currently authenticated user. ```APIDOC ## GET /crm/api/v2/auth/me ### Description Return the authenticated user. ### Method GET ### Endpoint /crm/api/v2/auth/me ``` -------------------------------- ### Enable Portal Registration via Environment Variable Source: https://laravelcrm.com/docs/2.x/portal Set this environment variable to true to allow visitors to register for portal accounts. ```bash LARAVEL_CRM_PORTAL_ALLOW_REGISTRATION=true ``` -------------------------------- ### GET /crm/api/v2/quotes Source: https://laravelcrm.com/docs/2.x/api-quotes Retrieve a paginated list of quotes. ```APIDOC ## GET /crm/api/v2/quotes ### Description Retrieve a paginated list of quotes. ### Method GET ### Endpoint /crm/api/v2/quotes ### Parameters #### Query Parameters - **per_page** (integer) - Optional - 1–100, default 25. - **sort** (string) - Optional - One of created_at, updated_at, title, total. Prefix - for descending. - **user_owner_id** (integer) - Optional - Filter by owner (user ID). ``` -------------------------------- ### GET /crm/api/v2/invoices Source: https://laravelcrm.com/docs/2.x/api-invoices List all invoices with pagination support. ```APIDOC ## GET /crm/api/v2/invoices ### Description List invoices in a paginated format. ### Method GET ### Endpoint /crm/api/v2/invoices ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, total, issue_date, due_date). Prefix with '-' for descending order. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### Create and Manage Teams Source: https://laravelcrm.com/docs/2.x/teams Demonstrates creating a new team instance and associating a user with that team. ```php use VentureDrake\LaravelCrm\Models\Team; // Create a team $team = Team::create([ 'name' => 'Sales Team', 'user_id' => auth()->id(), 'personal_team' => false, ]); // Add a user to the team $team->users()->attach($user->id); ``` -------------------------------- ### Create and associate a task Source: https://laravelcrm.com/docs/2.x/tasks Demonstrates creating a new task instance and associating it with a lead entity. ```php use VentureDrake\LaravelCrm\Models\Task; // Create a task attached to a lead $task = Task::create([ 'name' => 'Follow up call', 'description' => 'Call to discuss proposal', 'due_at' => now()->addDays(2), 'reminder_email' => true, 'user_assigned_id' => $user->id, ]); $task->taskable()->associate($lead)->save(); ``` -------------------------------- ### GET /crm/api/v2/orders Source: https://laravelcrm.com/docs/2.x/api-orders Retrieve a paginated list of orders. ```APIDOC ## GET /crm/api/v2/orders ### Description List all orders with pagination support. ### Method GET ### Endpoint /crm/api/v2/orders ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, total). Prefix with '-' for descending order. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### Publish and Run Sanctum Migrations Source: https://laravelcrm.com/docs/2.x/api Commands to set up the necessary database tables for Laravel Sanctum. ```bash php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider" php artisan migrate ``` -------------------------------- ### Run the test suite Source: https://laravelcrm.com/docs/2.x/contributing Execute the project's test suite using Orchestra Testbench and an in-memory SQLite database. ```bash composer test ``` -------------------------------- ### GET /crm/api/v2/people Source: https://laravelcrm.com/docs/2.x/api-people Retrieve a paginated list of people. ```APIDOC ## GET /crm/api/v2/people ### Description List all people in the CRM, supporting pagination and filtering. ### Method GET ### Endpoint /crm/api/v2/people ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of records per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, first_name, last_name). Prefix with '-' for descending order. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### Enable new modules in configuration Source: https://laravelcrm.com/docs/2.x/upgrading Add the 'features' and 'monitoring' strings to the modules array in your configuration file. ```php 'modules' => [ // ... existing modules 'features', 'monitoring', ], ``` -------------------------------- ### GET /crm/api/v2/auth/me Source: https://laravelcrm.com/docs/2.x/api Retrieves the details of the currently authenticated user. ```APIDOC ## GET /crm/api/v2/auth/me ### Description Retrieves the details of the currently authenticated user based on the provided Bearer token. ### Method GET ### Endpoint /crm/api/v2/auth/me ### Response #### Success Response (200) - **user** (object) - The authenticated user details. ``` -------------------------------- ### GET /crm/api/v2/leads/{uuid} Source: https://laravelcrm.com/docs/2.x/api-leads Retrieve details for a specific lead. ```APIDOC ## GET /crm/api/v2/leads/{uuid} ### Description Retrieve a single lead by its UUID. ### Method GET ### Endpoint /crm/api/v2/leads/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The lead's external_id (UUID). ``` -------------------------------- ### GET /crm/api/v2/quotes/{uuid} Source: https://laravelcrm.com/docs/2.x/api-quotes Retrieve a specific quote by its UUID. ```APIDOC ## GET /crm/api/v2/quotes/{uuid} ### Description Retrieve a specific quote by its UUID. ### Method GET ### Endpoint /crm/api/v2/quotes/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the quote. ``` -------------------------------- ### Create and Query Product Categories Source: https://laravelcrm.com/docs/2.x/product-categories Demonstrates how to instantiate a new product category and retrieve associated products using the relationship method. ```php use VentureDrake\LaravelCrm\Models\ProductCategory; $category = ProductCategory::create([ 'name' => 'Web Services', 'description' => 'Website design and development services', ]); // Get all products in a category $products = $category->products; ``` -------------------------------- ### Sync Products Source: https://laravelcrm.com/docs/2.x/xero Execute this command to fetch and sync products from Xero to the CRM. ```bash php artisan laravelcrm:xero products ``` -------------------------------- ### GET /crm/api/v2/invoices/{uuid} Source: https://laravelcrm.com/docs/2.x/api-invoices Retrieve a specific invoice by its UUID. ```APIDOC ## GET /crm/api/v2/invoices/{uuid} ### Description Retrieve details for a specific invoice. ### Method GET ### Endpoint /crm/api/v2/invoices/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the invoice. ``` -------------------------------- ### Create an Organisation Source: https://laravelcrm.com/docs/2.x/organizations Demonstrates how to instantiate a new organisation record using the Eloquent create method. ```php use VentureDrake\LaravelCrm\Models\Organisation; $org = Organisation::create([ 'name' => 'Acme Corp', 'description' => 'Software company', 'annual_revenue' => 1000000, // Stored in cents 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### GET /crm/api/v2/orders/{uuid} Source: https://laravelcrm.com/docs/2.x/api-orders Retrieve details of a specific order. ```APIDOC ## GET /crm/api/v2/orders/{uuid} ### Description Retrieve a single order by its UUID. ### Method GET ### Endpoint /crm/api/v2/orders/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the order. ``` -------------------------------- ### GET /crm/api/v2/deals/{uuid} Source: https://laravelcrm.com/docs/2.x/api-deals Retrieve details for a specific deal. ```APIDOC ## GET /crm/api/v2/deals/{uuid} ### Description Retrieve a single deal by its UUID. ### Method GET ### Endpoint /crm/api/v2/deals/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the deal. ``` -------------------------------- ### Create a product variation and pricing Source: https://laravelcrm.com/docs/2.x/product-attributes Demonstrates how to create a new product variation associated with a product and assign pricing to it. ```php // Create a product variation $variation = $product->productVariations()->create([ 'name' => 'Large / Red', 'description' => 'Large size, red colour', ]); // Add pricing $variation->productPrices()->create([ 'unit_price' => 2500, // in cents 'currency' => 'USD', ]); ``` -------------------------------- ### GET /crm/api/v2/organizations Source: https://laravelcrm.com/docs/2.x/api-organizations List all organizations with pagination and filtering options. ```APIDOC ## GET /crm/api/v2/organizations ### Description Retrieve a paginated list of organizations. ### Method GET ### Endpoint /crm/api/v2/organizations ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page (1-100, default 25). - **sort** (string) - Optional - Sort field (created_at, updated_at, name). Prefix with '-' for descending. - **user_owner_id** (integer) - Optional - Filter by owner user ID. ``` -------------------------------- ### Creating and Accessing Clients Source: https://laravelcrm.com/docs/2.x/customers Create a client from a person or organisation and access the underlying entity via the clientable relationship. ```php // Create a client from a person $client = $person->client()->create(); // Create a client from an organisation $client = $organisation->client()->create(); // Access the underlying entity $client->clientable; // Returns Person or Organisation instance ``` -------------------------------- ### GET /crm/api/v2/people/{uuid} Source: https://laravelcrm.com/docs/2.x/api-people Retrieve details for a specific person. ```APIDOC ## GET /crm/api/v2/people/{uuid} ### Description Retrieve the details of a specific person by their UUID. ### Method GET ### Endpoint /crm/api/v2/people/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the person. ``` -------------------------------- ### GET /crm/api/v2/organizations/{uuid} Source: https://laravelcrm.com/docs/2.x/api-organizations Retrieve details for a specific organization by its UUID. ```APIDOC ## GET /crm/api/v2/organizations/{uuid} ### Description Retrieve the details of a specific organization. ### Method GET ### Endpoint /crm/api/v2/organizations/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the organization. ``` -------------------------------- ### Seed Default Lead Sources Source: https://laravelcrm.com/docs/2.x/lead-sources Run this command to populate the database with default lead source records. ```bash php artisan laravelcrm:lead-sources ``` -------------------------------- ### Create a New Invoice Source: https://laravelcrm.com/docs/2.x/invoices Demonstrates creating an invoice record using the Invoice model. Note that all monetary values must be provided in cents. ```php use VentureDrake\LaravelCrm\Models\Invoice; $invoice = Invoice::create([ 'currency' => 'USD', 'subtotal' => 10000, 'tax' => 1000, 'total' => 11000, 'issue_date' => '2026-01-15', 'due_date' => '2026-02-15', 'order_id' => $order->id, 'person_id' => $person->id, 'organisation_id' => $organisation->id, 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### Configure Xero Environment Variables Source: https://laravelcrm.com/docs/2.x/xero Add your Xero OAuth2 credentials to the .env file to enable the integration. ```text XERO_CLIENT_ID=your-client-id XERO_CLIENT_SECRET=your-client-secret XERO_REDIRECT_URI=https://yoursite.com/xero/callback ``` -------------------------------- ### Manage Addresses via Relationship Source: https://laravelcrm.com/docs/2.x/addresses Demonstrates creating an address for an organisation and retrieving specific address types like primary, billing, or shipping. ```php // Add an address to an organisation $organisation->addresses()->create([ 'line1' => '123 Main St', 'city' => 'New York', 'state' => 'NY', 'code' => '10001', 'country' => 'US', 'primary' => true, ]); // Get primary address $address = $organisation->getPrimaryAddress(); // Get billing/shipping addresses $billing = $organisation->getBillingAddress(); // address_type_id = 5 $shipping = $organisation->getShippingAddress(); // address_type_id = 6 ``` -------------------------------- ### Run the automated update routine Source: https://laravelcrm.com/docs/2.x/upgrading Executes the update command to handle config, migrations, assets, and permissions in one step. ```bash php artisan laravelcrm:update ``` -------------------------------- ### Build frontend assets Source: https://laravelcrm.com/docs/2.x/contributing Compile the frontend assets required for the application interface. ```bash npm run build ``` -------------------------------- ### Publish Xero Configuration Source: https://laravelcrm.com/docs/2.x/xero Run this command to publish the package configuration files to your Laravel application. ```bash php artisan vendor:publish --provider="Dcblogdev\Xero\XeroServiceProvider" ``` -------------------------------- ### POST /crm/api/v2/products Source: https://laravelcrm.com/docs/2.x/api-products Create a new product. ```APIDOC ## POST /crm/api/v2/products ### Description Create a new product resource. ### Method POST ### Endpoint /crm/api/v2/products ### Parameters #### Request Body - **name** (string) - Required - Product name. - **code** (string) - Optional - Product code. - **barcode** (string) - Optional - Product barcode. - **description** (string) - Optional - Product description. - **unit** (string) - Optional - Unit of measure. - **unit_price** (float) - Optional - Unit price. - **currency** (string) - Optional - Currency code. - **tax_rate** (float) - Optional - Tax rate. - **tax_rate_id** (integer) - Optional - Tax rate ID. - **product_category_id** (uuid) - Optional - Product category UUID. - **purchase_account** (string) - Optional - Purchase account. - **sales_account** (string) - Optional - Sales account. - **active** (boolean) - Optional - Active status. - **user_owner_id** (integer) - Optional - Owner user ID. ``` -------------------------------- ### View Directory Structure Source: https://laravelcrm.com/docs/2.x/README Displays the organization of versioned documentation folders. ```text 1.x/ # v1 documentation (markdown) 2.x/ # v2 documentation (markdown) ``` -------------------------------- ### Update Permissions and Custom Fields Source: https://laravelcrm.com/docs/2.x/upgrading Run these commands to ensure permissions and custom fields are correctly configured for the new version. ```bash php artisan laravelcrm:permissions php artisan laravelcrm:fields ``` -------------------------------- ### Configure Default Settings Source: https://laravelcrm.com/docs/2.x/configuration Defines the default application settings for currency, localization, and formatting using environment variables. ```php 'currency' => env('LARAVEL_CRM_CURRENCY', 'USD'), 'country' => env('LARAVEL_CRM_COUNTRY', 'United States'), 'language' => env('LARAVEL_CRM_LANGUAGE', 'english'), 'timezone' => env('LARAVEL_CRM_TIMEZONE', 'UTC'), 'date_format' => env('LARAVEL_CRM_DATE_FORMAT', 'Y-m-d'), 'time_format' => env('LARAVEL_CRM_TIME_FORMAT', 'g:i A'), 'tax_name' => env('LARAVEL_CRM_TAX_NAME', 'Tax'), 'tax_rate' => env('LARAVEL_CRM_TAX_RATE', null), ``` -------------------------------- ### Issue a token via artisan Source: https://laravelcrm.com/docs/2.x/api Generate a token for a user using the command line interface. ```bash php artisan laravel-crm:api-token user@example.com --name="Mobile App" ``` -------------------------------- ### Configure environment variables for new modules Source: https://laravelcrm.com/docs/2.x/upgrading Optional environment variables for the Features and Monitoring modules with their default settings. ```bash # Features LARAVEL_CRM_FEATURES_VIEW_DEDUP_MINUTES=60 LARAVEL_CRM_PORTAL_ALLOW_REGISTRATION=false # Monitoring LARAVEL_CRM_MONITORING_DEFAULT_FREQUENCY_MINUTES=5 LARAVEL_CRM_MONITORING_DEFAULT_SSL_DAYS_BEFORE_EXPIRY_ALERT=14 LARAVEL_CRM_MONITORING_REQUEST_TIMEOUT_SECONDS=15 LARAVEL_CRM_MONITORING_SSL_RECHECK_HOURS=12 LARAVEL_CRM_MONITORING_ALLOW_PRIVATE_TARGETS=false ``` -------------------------------- ### Seed Default Labels Source: https://laravelcrm.com/docs/2.x/labels Command to populate the database with default label configurations. ```bash php artisan laravelcrm:labels ``` -------------------------------- ### Creating a Person Record Source: https://laravelcrm.com/docs/2.x/people Initialize a new person record and associate it with contact details like emails and phone numbers. ```php use VentureDrake\LaravelCrm\Models\Person; $person = Person::create([ 'first_name' => 'John', 'last_name' => 'Smith', 'organisation_id' => $organisation->id, 'user_owner_id' => auth()->id(), ]); // Add an email $person->emails()->create([ 'address' => 'john@example.com', 'type' => 'work', 'primary' => true, ]); // Add a phone number $person->phones()->create([ 'number' => '+1234567890', 'type' => 'work', 'primary' => true, ]); ``` -------------------------------- ### Configure Features and Portal Settings Source: https://laravelcrm.com/docs/2.x/features Define feature view de-duplication and portal registration settings within the configuration file. ```php // config/laravel-crm.php 'features' => [ 'view_dedup_minutes' => env('LARAVEL_CRM_FEATURES_VIEW_DEDUP_MINUTES', 60), ], 'portal' => [ 'allow_registration' => env('LARAVEL_CRM_PORTAL_ALLOW_REGISTRATION', false), ], ``` -------------------------------- ### Run Encryption Command Source: https://laravelcrm.com/docs/2.x/security Execute the artisan command to apply encryption to existing database fields. ```bash php artisan laravelcrm:encrypt ``` -------------------------------- ### Format and check code style Source: https://laravelcrm.com/docs/2.x/contributing Use these commands to format the codebase or perform a dry-run check using Laravel Pint. ```bash composer format # Run Laravel Pint formatter composer format-test # Dry-run formatting check ``` -------------------------------- ### Enable Teams via Environment Variable Source: https://laravelcrm.com/docs/2.x/teams Configuration setting to activate team functionality in the application environment. ```text LARAVEL_CRM_TEAMS=true ``` -------------------------------- ### Create a new Deal Source: https://laravelcrm.com/docs/2.x/deals Use the Deal model to create a new business opportunity. Note that the amount is stored in cents, so values should be provided accordingly. ```php use VentureDrake\LaravelCrm\Models\Deal; $deal = Deal::create([ 'title' => 'Website Redesign', 'amount' => 10000, // Stored as 1000000 (cents) 'currency' => 'USD', 'expected_close' => '2026-06-30', 'person_id' => $person->id, 'organisation_id' => $organisation->id, 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### Configure Monitoring Module Settings Source: https://laravelcrm.com/docs/2.x/configuration Defines default values for monitor frequency, SSL alerts, request timeouts, and security settings for private targets. ```php 'monitoring' => [ 'default_frequency_minutes' => env('LARAVEL_CRM_MONITORING_DEFAULT_FREQUENCY_MINUTES', 5), 'default_ssl_days_before_expiry_alert' => env('LARAVEL_CRM_MONITORING_DEFAULT_SSL_DAYS_BEFORE_EXPIRY_ALERT', 14), 'request_timeout_seconds' => env('LARAVEL_CRM_MONITORING_REQUEST_TIMEOUT_SECONDS', 15), 'ssl_recheck_hours' => env('LARAVEL_CRM_MONITORING_SSL_RECHECK_HOURS', 12), 'allow_private_targets' => env('LARAVEL_CRM_MONITORING_ALLOW_PRIVATE_TARGETS', false), ], ``` -------------------------------- ### Create a Purchase Order Source: https://laravelcrm.com/docs/2.x/purchase-orders Use the PurchaseOrder model to create a new record. Ensure monetary values are provided in cents. ```php use VentureDrake\LaravelCrm\Models\PurchaseOrder; $po = PurchaseOrder::create([ 'currency' => 'USD', 'subtotal' => 5000, 'tax' => 500, 'total' => 5500, 'order_id' => $order->id, 'organisation_id' => $supplier->id, 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### Verify API Routes Source: https://laravelcrm.com/docs/2.x/api Command to list all registered API routes under the crm/api path. ```bash php artisan route:list --path=crm/api ``` -------------------------------- ### API Authentication and Lead Management Workflow Source: https://laravelcrm.com/docs/2.x/api A sequence of cURL commands to issue a token, list leads, create a lead, and revoke the token. ```bash # 1. Issue a token curl -s -X POST https://example.test/crm/api/v2/auth/token \ -H "Content-Type: application/json" \ -d '{"email":"user@example.com","password":"secret","device_name":"curl"}' \ | jq . # 2. List leads TOKEN="1|abcdef..." curl -s https://example.test/crm/api/v2/leads \ -H "Authorization: Bearer $TOKEN" \ -H "Accept: application/json" \ | jq . # 3. Create a lead curl -s -X POST https://example.test/crm/api/v2/leads \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "New enterprise lead", "amount": 12500.00, "currency": "USD", "expected_close": "2026-09-30T00:00:00Z" }' \ | jq . # 4. Revoke the token curl -s -X DELETE https://example.test/crm/api/v2/auth/token \ -H "Authorization: Bearer $TOKEN" \ -i ``` -------------------------------- ### Creating a New Order Source: https://laravelcrm.com/docs/2.x/orders Instantiates a new order record using the Order model. Note that monetary values must be provided in cents. ```php use VentureDrake\LaravelCrm\Models\Order; $order = Order::create([ 'currency' => 'USD', 'subtotal' => 10000, 'tax' => 1000, 'total' => 11000, 'person_id' => $person->id, 'organisation_id' => $organisation->id, 'quote_id' => $quote->id, 'user_owner_id' => auth()->id(), ]); ``` -------------------------------- ### Create and Assign Tax Rate Source: https://laravelcrm.com/docs/2.x/tax-rates Create a new tax rate record and associate it with a product as the default rate. ```php use VentureDrake\LaravelCrm\Models\TaxRate; $taxRate = TaxRate::create([ 'name' => 'GST', 'rate' => 10.00, 'default' => true, ]); // Assign as the default tax rate for a product $product->update(['tax_rate_id' => $taxRate->id]); ``` -------------------------------- ### Enable Encryption in Environment Source: https://laravelcrm.com/docs/2.x/installation Set the environment variable to enable database field encryption. ```text LARAVEL_CRM_ENCRYPT_DB_FIELDS=true ``` -------------------------------- ### Dispatch Email Campaigns via Artisan Source: https://laravelcrm.com/docs/2.x/email-marketing Command to trigger the dispatching of scheduled email campaigns. ```bash php artisan laravelcrm:email-campaigns-dispatch ``` -------------------------------- ### Sync Data via Artisan Source: https://laravelcrm.com/docs/2.x/xero Use the artisan command to trigger a sync for a specific model type. ```bash php artisan laravelcrm:xero {model} ``` -------------------------------- ### Run update steps manually Source: https://laravelcrm.com/docs/2.x/upgrading Alternative commands to perform individual update tasks if not using the automated routine. ```bash 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 laravelcrm:permissions php artisan laravelcrm:labels php artisan laravelcrm:fields ``` -------------------------------- ### Create and Populate a Custom Field Group Source: https://laravelcrm.com/docs/2.x/custom-field-groups Demonstrates creating a new field group instance and associating a custom field with it using the model relationships. ```php use VentureDrake"::"LaravelCrm\\Models\\FieldGroup; // Create a field group for leads $group = FieldGroup::create([ 'name' => 'Additional Info', 'handle' => 'additional_info', 'model' => 'VentureDrake\\LaravelCrm\\Models\\Lead', 'order' => 1, ]); // Add a field to the group $group->fields()->create([ 'name' => 'Source URL', 'handle' => 'source_url', 'type' => 'text', 'required' => false, 'order' => 1, ]); ``` -------------------------------- ### Configure Features Module Source: https://laravelcrm.com/docs/2.x/configuration Sets the view de-duplication window in minutes for the features module. ```php 'features' => [ 'view_dedup_minutes' => env('LARAVEL_CRM_FEATURES_VIEW_DEDUP_MINUTES', 60), ], ``` -------------------------------- ### Enable Private Targets via Environment Variable Source: https://laravelcrm.com/docs/2.x/monitoring Set this environment variable to allow monitors to target internal infrastructure or private network services. ```bash LARAVEL_CRM_MONITORING_ALLOW_PRIVATE_TARGETS=true ``` -------------------------------- ### Configure Laravel Scheduler Source: https://laravelcrm.com/docs/2.x/monitoring Add this cron entry to your server to ensure scheduled monitor checks are executed at their configured intervals. ```bash * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 ``` -------------------------------- ### POST /crm/api/v2/deals Source: https://laravelcrm.com/docs/2.x/api-deals Create a new deal resource. ```APIDOC ## POST /crm/api/v2/deals ### Description Create a new deal in the system. ### Method POST ### Endpoint /crm/api/v2/deals ### Request Body - **title** (string) - Required - The title of the deal. - **description** (string) - Optional - Description of the deal. - **amount** (float) - Optional - Deal amount. - **currency** (string) - Optional - Currency code. - **expected_close** (string) - Optional - Expected closing date. - **lead_id** (uuid) - Optional - Associated lead ID. - **person_id** (uuid) - Optional - Associated person ID. - **organization_id** (uuid) - Optional - Associated organization ID. - **pipeline_stage_id** (uuid) - Optional - Pipeline stage ID. - **user_owner_id** (integer) - Optional - Owner user ID. - **labels** (array) - Optional - Array of label UUIDs. ``` -------------------------------- ### Retrieve default product price Source: https://laravelcrm.com/docs/2.x/products Fetches the default price for a product based on the system's configured currency. ```php $price = $product->getDefaultPrice(); ``` -------------------------------- ### Configure Teams Support Source: https://laravelcrm.com/docs/2.x/configuration Enables multi-tenant support for Laravel Jetstream or Spark teams. Requires Spatie Permissions v5+ with teams support enabled. ```php 'teams' => env('LARAVEL_CRM_TEAMS', false), ``` -------------------------------- ### Configure Portal Module Settings Source: https://laravelcrm.com/docs/2.x/configuration Controls public-facing portal access, specifically enabling or disabling visitor self-registration. ```php 'portal' => [ 'allow_registration' => env('LARAVEL_CRM_PORTAL_ALLOW_REGISTRATION', false), ], ``` -------------------------------- ### Seed Permissions Source: https://laravelcrm.com/docs/2.x/permissions Run the artisan command to seed the CRM permissions into the database. ```bash php artisan laravelcrm:permissions ``` -------------------------------- ### Seed Address Types Source: https://laravelcrm.com/docs/2.x/addresses Command to seed the default address types into the database. ```bash php artisan laravelcrm:address-types ``` -------------------------------- ### POST /crm/api/v2/orders Source: https://laravelcrm.com/docs/2.x/api-orders Create a new order. ```APIDOC ## POST /crm/api/v2/orders ### Description Create a new order record. ### Method POST ### Endpoint /crm/api/v2/orders ### Parameters #### Request Body - **reference** (string) - Optional - **description** (string) - Optional - **currency** (string) - Optional - **terms** (string) - Optional - **subtotal** (float) - Optional - **discount** (float) - Optional - **tax** (float) - Optional - **adjustments** (float) - Optional - **total** (float) - Optional - **person_id** (uuid) - Optional - **organization_id** (uuid) - Optional - **quote_id** (uuid) - Optional - **user_owner_id** (integer) - Optional - **labels[]** (array) - Optional - Array of UUIDs - **line_items[]** (array) - Optional ``` -------------------------------- ### Accessing the Order Title Source: https://laravelcrm.com/docs/2.x/orders Retrieves a formatted string containing the monetary total and the associated client or organisation name. ```php $order->title; // "$1,500.00 - Acme Corp" ``` -------------------------------- ### POST /crm/api/v2/leads Source: https://laravelcrm.com/docs/2.x/api-leads Create a new lead in the CRM. ```APIDOC ## POST /crm/api/v2/leads ### Description Create a new lead record. ### Method POST ### Endpoint /crm/api/v2/leads ### Request Body - **title** (string) - Required - The title of the lead. - **description** (string) - Optional - Lead description. - **amount** (float) - Optional - Lead amount. - **currency** (string) - Optional - 3-letter currency code. - **expected_close** (string) - Optional - Expected close date in ISO-8601 format. - **person_id** (uuid) - Optional - Associated person ID. - **organization_id** (uuid) - Optional - Associated organization ID. - **lead_source_id** (uuid) - Optional - Lead source ID. - **pipeline_stage_id** (uuid) - Optional - Pipeline stage ID. - **user_owner_id** (integer) - Optional - Owner user ID. - **labels[]** (array) - Optional - Array of label UUIDs. ``` -------------------------------- ### Configure Monitoring Settings Source: https://laravelcrm.com/docs/2.x/monitoring Define default monitoring behavior within the laravel-crm configuration file. ```php // config/laravel-crm.php 'monitoring' => [ 'default_frequency_minutes' => env('LARAVEL_CRM_MONITORING_DEFAULT_FREQUENCY_MINUTES', 5), 'default_ssl_days_before_expiry_alert' => env('LARAVEL_CRM_MONITORING_DEFAULT_SSL_DAYS_BEFORE_EXPIRY_ALERT', 14), 'request_timeout_seconds' => env('LARAVEL_CRM_MONITORING_REQUEST_TIMEOUT_SECONDS', 15), 'ssl_recheck_hours' => env('LARAVEL_CRM_MONITORING_SSL_RECHECK_HOURS', 12), 'allow_private_targets' => env('LARAVEL_CRM_MONITORING_ALLOW_PRIVATE_TARGETS', false), ], ``` -------------------------------- ### Configure User Interface Source: https://laravelcrm.com/docs/2.x/configuration Toggle the built-in CRM user interface. Disabling this prevents default routes from loading. ```php 'user_interface' => env('LARAVEL_CRM_USER_INTERFACE', true), ``` -------------------------------- ### Route Configuration Source: https://laravelcrm.com/docs/2.x/installation Update web routes if the CRM route prefix is set to blank. ```php Route::middleware(['auth'])->get('/dashboard', function () { return redirect('/'); })->name('dashboard'); ``` -------------------------------- ### Retrieve Product Resource Shape Source: https://laravelcrm.com/docs/2.x/api-products Displays the JSON structure of a product object returned by the API. ```json { "id": "uuid", "name": "Annual subscription", "code": "SUB-1Y", "barcode": null, "description": null, "unit": "ea", "tax_rate": 10.0, "tax_rate_id": 3, "product_category_id": "uuid", "purchase_account": null, "sales_account": null, "active": true, "prices": [ { "currency": "USD", "unit_price": 99.00, "default": true } ], "owner": { "id": 1, "name": "Jane Doe" } } ``` -------------------------------- ### PUT /crm/api/v2/products/{uuid} Source: https://laravelcrm.com/docs/2.x/api-products Update an existing product. ```APIDOC ## PUT /crm/api/v2/products/{uuid} ### Description Update an existing product resource. ### Method PUT ### Endpoint /crm/api/v2/products/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the product. #### Request Body - **name** (string) - Optional - Product name. - **code** (string) - Optional - Product code. - **barcode** (string) - Optional - Product barcode. - **description** (string) - Optional - Product description. - **unit** (string) - Optional - Unit of measure. - **unit_price** (float) - Optional - Unit price. - **currency** (string) - Optional - Currency code. - **tax_rate** (float) - Optional - Tax rate. - **tax_rate_id** (integer) - Optional - Tax rate ID. - **product_category_id** (uuid) - Optional - Product category UUID. - **purchase_account** (string) - Optional - Purchase account. - **sales_account** (string) - Optional - Sales account. - **active** (boolean) - Optional - Active status. - **user_owner_id** (integer) - Optional - Owner user ID. ``` -------------------------------- ### Create a New Delivery Source: https://laravelcrm.com/docs/2.x/deliveries Instantiates a new delivery record linked to an order, requiring the order ID and owner user ID. ```php use VentureDrake\LaravelCrm\Models\Delivery; $delivery = Delivery::create([ 'order_id' => $order->id, 'delivery_expected' => '2026-02-01', 'user_owner_id' => auth()->id(), ]); ```