Skip to content

Commit

Permalink
update table migration
Browse files Browse the repository at this point in the history
  • Loading branch information
saifulcoder committed Feb 6, 2022
1 parent f65a2af commit bf1fbb6
Show file tree
Hide file tree
Showing 30 changed files with 17,146 additions and 94 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@ PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

URL_WA_SERVER=http://localhost:8000
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/node_modules
/public/hot
/public/storage
/public/vendor
/storage/*.key
/vendor
.env
Expand Down
151 changes: 62 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,66 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>

# Baileys Restful API with Laravel
An implementation of [@adiwajshing/Baileys] (https://github.com/adiwajshing/Baileys) as a simple RESTful API service with multiple device support.

## Credits
1. Framework : Laravel 8
2. Admin Panel : Crudbooster
3. Backend Server : [@ookamiiixd/baileys-api](https://github.com/ookamiiixd/baileys-api)


## Frontend Installation

1. You can install the package via composer:
```bash
composer create-project saifulcoder/laravel-wa-server laravel-wa-server
```
2. Execute `npm i` to install the dependencies.
3. Setting the database configuration, open `.env` file at project root directory
```bash
DB_DATABASE=**your_db_name**
DB_USERNAME=**your_db_user**
DB_PASSWORD=**password**
```
4. Setting the URL backend server configuration, open `.env` file at project root directory
```bash
URL_WA_SERVER=http://localhost:8000
```
5. Create the media-table by running the migrations:
```bash
php artisan migrate
```
6. run laravel
```bash
php artisan serve --port=80
```
7. Dashboard Admin
```bash
/admin/login
```
default email : [email protected]
default password : 123456


## Backend Installation

Simple RESTful WhatsApp API by [@ookamiiixd/baileys-api](https://github.com/ookamiiixd/baileys-api) .

1. Enter to the backend project directory `cd backend`.
2. Execute `npm i` to install the dependencies.
3. You can start the app by executing `npm run start` or `node .`.
4. Now the endpoint should be available according to your environment variable settings. Default is at `http://localhost:8000`.

### Backend API DOCs

The API documentation is available online at [here](https://documenter.getpostman.com/view/18988925/UVRHiNne). You can also import the **Postman Collection File** `(postman_collection.json)` into your Postman App alternatively.

The server will respond in JSON format:

```javascript
{
success: true|false, // bool
message: "", // string
data: {} // object
}
```

# Functions laravel-wa-server

| | |
|---------------------------------------------------------------|---|
| Multiple Device ||
| 📁 Send **text** ||
| Admin Panel ||
| Multiple Users ||
| User Privilege ||
| API RESTFul ||
| 📁 Send **image, video, audio and docs** | coming soon |
| Send Buttons | coming soon |
| Send stickers | coming soon |
| Send stickers GIF | coming soon |
| Send Bulk Message | coming soon |
| Send Message with schedule | coming soon |
| Receive message | coming soon |
| Get Chat List | coming soon |
| Get Chat Conversation | coming soon |
| Webhook | coming soon |
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[CMS Max](https://www.cmsmax.com/)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
- **[Romega Software](https://romegasoftware.com)**

## Contributing

This project helps you and you want to help keep it going? Buy me a coffee:
<br> <a href="https://www.buymeacoffee.com/saifulcoder" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 61px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a><br>
or via <br>
<a href="https://saweria.co/saifulcoder">https://saweria.co/saifulcoder</a>
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
4 changes: 2 additions & 2 deletions app/Http/Controllers/AdminDeviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function cbInit() {
$this->form = [];
$this->form[] = ['label'=>'Number','name'=>'number','type'=>'number','validation'=>'required|min:1','width'=>'col-sm-10'];
$this->form[] = ['label'=>'Name','name'=>'name','type'=>'text','validation'=>'required|string|min:3|max:70','width'=>'col-sm-10'];
$this->form[] = ['label'=>'Description','name'=>'description','type'=>'text','validation'=>'required|min:1|max:255','width'=>'col-sm-10','placeholder'=>'You can only enter the letter only'];
$this->form[] = ['label'=>'Description','name'=>'description','type'=>'text','validation'=>'max:255','width'=>'col-sm-10','placeholder'=>'You can only enter the letter only'];
# END FORM DO NOT REMOVE THIS LINE

# OLD START FORM
Expand Down Expand Up @@ -132,7 +132,7 @@ public function hook_after_edit($id) {
}
public function hook_before_delete($id) {
$d = DB::table('device')->select('name')->where('id',$id)->first();
Http::get(env('URL_WA_SERVER').'/session/delete/'.$d->name);
Http::delete(env('URL_WA_SERVER').'/session/delete/'.$d->name);

}
public function hook_after_delete($id) {
Expand Down
10 changes: 9 additions & 1 deletion app/Http/Controllers/AdminOutboxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,17 @@ public function hook_row_index($column_index,&$column_value) {
}
public function hook_before_add(&$postdata) {

$getnumber = substr($postdata['number'], 1);
$regional = 62;
if($getnumber == 0 || $getnumber == 8 ){
$format_number = $regional.substr($postdata['number'], 1);
}else{
$format_number = $postdata['number'];
}

$device = DB::table('device')->select('name')->where('id',$postdata['id_device'])->first();
$response = Http::post(env('URL_WA_SERVER').'/chat/send?id='.$device->name, [
'receiver' => $postdata['number'],
'receiver' => $format_number,
'message' => $postdata['text']]);
$res = json_decode($response->getBody());
$postdata['status'] = $res->success;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

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

class CreateCmsApicustomTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_apicustom', function (Blueprint $table) {
$table->increments('id');
$table->string('permalink')->nullable();
$table->string('tabel')->nullable();
$table->string('aksi')->nullable();
$table->string('kolom')->nullable();
$table->string('orderby')->nullable();
$table->string('sub_query_1')->nullable();
$table->string('sql_where')->nullable();
$table->string('nama')->nullable();
$table->string('keterangan')->nullable();
$table->string('parameter')->nullable();
$table->timestamps();
$table->string('method_type', 25)->nullable();
$table->longText('parameters')->nullable();
$table->longText('responses')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cms_apicustom');
}
}
34 changes: 34 additions & 0 deletions database/migrations/2022_02_06_115659_create_cms_apikey_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

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

class CreateCmsApikeyTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_apikey', function (Blueprint $table) {
$table->increments('id');
$table->string('screetkey')->nullable();
$table->integer('hit')->nullable();
$table->string('status', 25)->default('active');
$table->timestamps();
});
}

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

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

class CreateCmsDashboardTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_dashboard', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->integer('id_cms_privileges')->nullable();
$table->longText('content')->nullable();
$table->timestamps();
});
}

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

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

class CreateCmsEmailQueuesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_email_queues', function (Blueprint $table) {
$table->increments('id');
$table->dateTime('send_at')->nullable();
$table->string('email_recipient')->nullable();
$table->string('email_from_email')->nullable();
$table->string('email_from_name')->nullable();
$table->string('email_cc_email')->nullable();
$table->string('email_subject')->nullable();
$table->text('email_content')->nullable();
$table->text('email_attachments')->nullable();
$table->boolean('is_sent')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cms_email_queues');
}
}
Loading

0 comments on commit bf1fbb6

Please sign in to comment.