mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
Merge conflicts Fixed
This commit is contained in:
@@ -7,8 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Deliveryinfo extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
|
||||
'branch',
|
||||
'deli_info',
|
||||
'address',
|
||||
'city',
|
||||
@@ -22,7 +20,7 @@ class Deliveryinfo extends Model
|
||||
|
||||
public function company(){
|
||||
|
||||
return $this->belongsTo(App/Company);
|
||||
return $this->belongsTo(App\Company);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class AuthController extends Controller
|
||||
$token = mt_rand(0000,9999);
|
||||
|
||||
// for testing
|
||||
if($request->phone == '0123456789'){
|
||||
if($request->phone == '0143499252'){
|
||||
$token = "1234";
|
||||
}
|
||||
|
||||
@@ -159,6 +159,12 @@ class AuthController extends Controller
|
||||
|
||||
return response()->json(['success'=> true, 'message'=> 'Profile updated.'], 200);
|
||||
}
|
||||
public function show()
|
||||
{
|
||||
return response()->json(['user' => Auth::user()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -294,4 +300,6 @@ class AuthController extends Controller
|
||||
'success' => false, 'data'=> ['message'=> 'Invalid token or email or expired code']
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,14 +12,8 @@ class DeliveryinfoController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
|
||||
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
return response()->json($deliveryinfo, 200);
|
||||
$deliveryinfos = Deliveryinfo::orderBy('id', 'desc')->get();
|
||||
return response()->json($deliveryinfos, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,8 +24,8 @@ class DeliveryinfoController extends Controller
|
||||
*/
|
||||
public function show(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->first();
|
||||
|
||||
//$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->first();
|
||||
$deliveryinfo = Deliveryinfo::find($id)->first();
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
@@ -46,7 +40,6 @@ class DeliveryinfoController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
$deliveryinfo = new Deliveryinfo;
|
||||
$deliveryinfo->branch = $request->input('branch');
|
||||
$deliveryinfo->deli_info = $request->input('deli_info');
|
||||
$deliveryinfo->address = $request->input('address');
|
||||
$deliveryinfo->city = $request->input('city');
|
||||
@@ -55,7 +48,7 @@ class DeliveryinfoController extends Controller
|
||||
$deliveryinfo->country = $request->input('country');
|
||||
$deliveryinfo->contact_person = $request->input('contact_person');
|
||||
$deliveryinfo->contact_person_no = $request->input('contact_person_no');
|
||||
$deliveryinfo->com_id = $user->company();
|
||||
$deliveryinfo->com_id = $user->company()->first()->id;
|
||||
$deliveryinfo->save();
|
||||
|
||||
return response()->json(['deliveryinfo'=>$deliveryinfo],201);
|
||||
@@ -70,14 +63,15 @@ class DeliveryinfoController extends Controller
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
//$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
$deliveryinfo = Deliveryinfo::find($id);
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
$deliveryinfo->branch = $request->input('branch');
|
||||
|
||||
$deliveryinfo->deli_info = $request->input('deli_info');
|
||||
$deliveryinfo->address = $request->input('address');
|
||||
$deliveryinfo->city = $request->input('city');
|
||||
@@ -86,7 +80,7 @@ class DeliveryinfoController extends Controller
|
||||
$deliveryinfo->country = $request->input('country');
|
||||
$deliveryinfo->contact_person = $request->input('contact_person');
|
||||
$deliveryinfo->contact_person_no = $request->input('contact_person_no');
|
||||
$deliveryinfo->com_id = $user->company();
|
||||
$deliveryinfo->com_id = $user->company()->first()->id;
|
||||
$deliveryinfo->save();
|
||||
|
||||
return response()->json(['deliveryinfo'=>$deliveryinfo],200);
|
||||
@@ -101,8 +95,8 @@ class DeliveryinfoController extends Controller
|
||||
*/
|
||||
public function destroy(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
|
||||
//$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
$deliveryinfo = Deliveryinfo::find($id)->first();
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
@@ -110,6 +104,6 @@ class DeliveryinfoController extends Controller
|
||||
|
||||
$deliveryinfo->delete($id);
|
||||
|
||||
return response()->json($deliveryinfo, 204);
|
||||
return response()->json(['deliveryinfo'=>$deliveryinfo], 204);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ class Warehouse extends Model
|
||||
|
||||
public function company(){
|
||||
|
||||
return $this->belongsTo(App/Company);
|
||||
return $this->belongsTo(App\Company);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"aloha/twilio": "^4.0",
|
||||
"doctrine/dbal": "~2.3",
|
||||
"doctrine/dbal": "^2.8",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"intervention/image": "^2.4",
|
||||
"laravel/framework": "5.6.*",
|
||||
|
||||
Generated
+5007
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveBranchFromDeliveryinfos extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('deliveryinfos', function (Blueprint $table) {
|
||||
$table->dropColumn('branch');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('deliveryinfos', function (Blueprint $table) {
|
||||
$table->string('branch');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class CompanySeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('companies')->truncate();
|
||||
//DB::table('companies')->truncate();
|
||||
DB::table('companies')->insert([
|
||||
'id' => '999',
|
||||
'company_profile'=>'testing',
|
||||
@@ -30,7 +30,7 @@ class CompanySeeder extends Seeder
|
||||
'contact_person'=>'testing',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'user_id' => '2'
|
||||
'user_id' => '5'
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ class DeliveryInfoSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
DB::table('deliveryinfos')->insert([
|
||||
|
||||
'id' => '999',
|
||||
'branch' => 'testing',
|
||||
|
||||
'deli_info' => 'testing',
|
||||
'address' => 'testing',
|
||||
'city' => 'testing',
|
||||
|
||||
Vendored
+10419
File diff suppressed because it is too large
Load Diff
+1040
-913
File diff suppressed because it is too large
Load Diff
Vendored
+47387
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"/js/app.js": "/js/app.js",
|
||||
"/css/app.css": "/css/app.css"
|
||||
}
|
||||
@@ -13,13 +13,25 @@
|
||||
- HTML, CSS, Jquery
|
||||
- Authentication with JWT
|
||||
|
||||
## Installation
|
||||
## Installation (For Windows)
|
||||
- Download and install [Laragon](https://laragon.org/download/)
|
||||
- `cd` to your local dev server htdocs or www folder
|
||||
- `git clone git@gitlab.com:CIEFWorldwideSdnBhd/izyim-api.git`
|
||||
- create a new database for your app and name it whatever you like.
|
||||
- Copy `.env-example` to `.env`
|
||||
- Edit `.env` and set your database connection details
|
||||
- Run `composer install`
|
||||
- Run `php artisan migrate`
|
||||
- Run`php artisan db:seed`
|
||||
- Run `php artisan serve`
|
||||
- Navigate to `http://localhost:8000` it should show the UI
|
||||
|
||||
|
||||
## Installation (For Linux or OSX)
|
||||
- Install [Git](https://git-scm.com) , [Docker CE](https://docs.docker.com/) and [Docker compose](https://docs.docker.com/compose/install/), [Node](https://nodejs.org/en/download/)
|
||||
- `git clone git@gitlab.com:CIEFWorldwideSdnBhd/izyim-api.git`
|
||||
- Copy `.env-example` to `.env`
|
||||
- Edit `.env` and set your database connection details
|
||||
|
||||
## Usage
|
||||
- Run `docker-compose up`
|
||||
|
||||
#### Test Credentials
|
||||
|
||||
+3
-3
@@ -55,10 +55,10 @@ Route::group(['middleware' => ['jwt.auth']], function() {
|
||||
|
||||
// Delivery-Info
|
||||
Route::get('/deliveryinfo/','DeliveryinfoController@index');
|
||||
Route::get('/deliveryinfo/{com_id}','DeliveryinfoController@show');
|
||||
Route::get('/deliveryinfo/{id}','DeliveryinfoController@show');
|
||||
Route::post('/deliveryinfo', 'DeliveryinfoController@store');
|
||||
Route::put('/deliveryinfo/{com_id}', 'DeliveryinfoController@update');
|
||||
Route::delete('/deliveryinfo/{com_id}', 'DeliveryinfoController@destroy');
|
||||
Route::put('/deliveryinfo/{id}', 'DeliveryinfoController@update');
|
||||
Route::delete('/deliveryinfo/{id}', 'DeliveryinfoController@destroy');
|
||||
|
||||
|
||||
/* Company */
|
||||
|
||||
Reference in New Issue
Block a user