Skip to content

Commit

Permalink
Feat: First commit, accommodating the project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilio Puljiz committed Mar 20, 2024
1 parent 3613bb6 commit 81bd88f
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 150 deletions.
68 changes: 21 additions & 47 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,42 @@
{
"name": ":vendor_slug/:package_slug",
"description": ":package_description",
"name": "emiliopuljiz/api-whatsapp-business",
"description": "With this package you can create WhatsApp Business templates, start conversations through these templates. We are also going to have a panel to be able to receive and send messages with clients that we start conversations with.",
"keywords": [
":vendor_name",
"emiliopuljiz",
"laravel",
":package_slug"
"api-whatsapp-business"
],
"homepage": "https://github.com/:vendor_slug/:package_slug",
"homepage": "https://github.com/EmilioPuljiz/api-whatsapp-business",
"license": "MIT",
"authors": [
{
"name": ":author_name",
"email": "[email protected]",
"role": "Developer"
"name": "Emilio Puljiz",
"email": "[email protected]",
"homepage": "http://www.vidadigital.com.ar",
"role": "CEO & CTO"
}
],
"require": {
"php": "^8.2",
"php": "^8.2|^8.2",
"spatie/laravel-package-tools": "^1.16",
"illuminate/contracts": "^10.0||^11.0"
},
"require-dev": {
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.1.1||^7.10.0",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^9.0.0||^8.22.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-arch": "^2.7",
"pestphp/pest-plugin-laravel": "^2.3",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"spatie/laravel-ray": "^1.35"
"illuminate/support": "^10.0||^11.0",
"illuminate/contracts": "^10.0||^11.0",
"illuminate/database": "^10.0||^11.0",
"illuminate/container": "^10.0||^11.0",
"illuminate/auth": "^10.0||^11.0"
},
"require-dev": {},
"autoload": {
"psr-4": {
"VendorName\\Skeleton\\": "src/",
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories/"
"EmilioPuljiz\\ApiWhatsappBusiness\\": "src/",
"EmilioPuljiz\\ApiWhatsappBusiness\\Database\\Factories\\": "database/factories/"
}
},
"autoload-dev": {
"psr-4": {
"VendorName\\Skeleton\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/"
"EmilioPuljiz\\ApiWhatsappBusiness\\Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": "@composer run prepare",
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": [
"@composer run prepare",
"@php vendor/bin/testbench workbench:build --ansi"
],
"start": [
"Composer\\Config::disableProcessTimeout",
"@composer run build",
"@php vendor/bin/testbench serve"
],
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/pint"
},
"config": {
"sort-packages": true,
"allow-plugins": {
Expand All @@ -73,10 +47,10 @@
"extra": {
"laravel": {
"providers": [
"VendorName\\Skeleton\\SkeletonServiceProvider"
"EmilioPuljiz\\ApiWhatsappBusiness\\ApiWhatsappBusinessServiceProvider"
],
"aliases": {
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
"ApiWhatsappBusiness": "EmilioPuljiz\\ApiWhatsappBusiness\\Facades\\ApiWhatsappBusiness"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

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

class CreateWhatsappConfigurationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('whatsapp_configurations', function (Blueprint $table) {
$table->id();

$table->string('client_id');
$table->string('client_secret');
$table->text('access_token');
$table->dateTime('expires_in');
$table->string('phone_number_id');

$table->unsignedBigInteger('configuration_id');
$table->foreign('configuration_id')->references('id')->on('configurations');

$table->softDeletes();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('whatsapp_configurations');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

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

class CreateWhatsappNotificationsTable extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('whatsapp_notifications', function (Blueprint $table) {
$table->id();
$table->text('title')->nullable();
$table->text('description')->nullable();
$table->string('template');
$table->boolean('is_active');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('whatsapp_notification');
}
};
19 changes: 0 additions & 19 deletions database/migrations/create_skeleton_table.php.stub

This file was deleted.

Empty file removed resources/views/.gitkeep
Empty file.
39 changes: 39 additions & 0 deletions src/ApiWhatsappBusinessServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace EmilioPuljiz\ApiWhatsappBusiness;

use Illuminate\Support\ServiceProvider;

class ApiWhatsappBusinessServiceProvider extends ServiceProvider
{
/**
* Bootstrap any package services.
*/
public function boot(): void
{
if (!class_exists('CreateWhatsappConfigurationsTable')) {
$this->publishes([
__DIR__ . '/../database/migrations/2023_04_21_110851_create_whatsapp_configurations_table.php' => database_path('migrations/' . date('Y_m_d_His', time()) . 'create_whatsapp_configurations_table.php'),
]);
}

if (!class_exists('CreateWhatsappNotificationsTable')) {
$this->publishes([
__DIR__ . '/../database/migrations/2024_03_04_161027_create_whatsapp_notification_table.php' => database_path('migrations/' . date('Y_m_d_His', time()) . 'create_whatsapp_notification_table.php'),
]);
}

$this->loadMigrationsFrom(__DIR__ . '/../database/migrations/', 'migrations');
}

/**
* Register any application services.
*/
public function register(): void
{
$this->mergeConfigFrom(
__DIR__ . '/../config/courier.php',
'courier'
);
}
}
2 changes: 1 addition & 1 deletion src/Commands/SkeletonCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace VendorName\Skeleton\Commands;
namespace EmilioPuljiz\ApiWhatsappBusiness\Commands;

use Illuminate\Console\Command;

Expand Down
23 changes: 23 additions & 0 deletions src/Models/WhatsappConfiguration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace EmilioPuljiz\ApiWhatsappBusiness\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class WhatsappConfiguration extends Model
{
use HasFactory;

protected $table = "whatsapp_configurations";

protected $fillable = [
'id',
'client_id',
'client_secret',
'access_token',
'expires_in',
'phone_number_id',
'configuration_id',
];
}
21 changes: 21 additions & 0 deletions src/Models/WhatsappNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace EmilioPuljiz\ApiWhatsappBusiness\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class WhatsappNotification extends Model
{
use HasFactory;

protected $table = "whatsapp_notifications";

protected $fillable = [
'id',
'template',
'title',
'description',
'is_active'
];
}
7 changes: 0 additions & 7 deletions src/Skeleton.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/SkeletonServiceProvider.php

This file was deleted.

Loading

0 comments on commit 81bd88f

Please sign in to comment.