mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
Merge branch 'zain/delivery-info' into 'master'
Zain/delivery info See merge request CIEFWorldwideSdnBhd/izyim-api!4
This commit is contained in:
@@ -14,4 +14,10 @@ class Company extends Model
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function deliveryinfo() {
|
||||
|
||||
return $this->hasMany('App\Deliveryinfo');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Deliveryinfo extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'branch',
|
||||
'deli_info',
|
||||
'address',
|
||||
'city',
|
||||
'postcode',
|
||||
'state',
|
||||
'country',
|
||||
'contact_person',
|
||||
'contact_person_no',
|
||||
'com_id'
|
||||
];
|
||||
|
||||
public function company() {
|
||||
|
||||
return $this->belongsTo('App\Company');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Deliveryinfo;
|
||||
use Auth;
|
||||
|
||||
class DeliveryinfoController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified delivery-info.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly delivery-info in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$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');
|
||||
$deliveryinfo->postcode = $request->input('postcode');
|
||||
$deliveryinfo->state = $request->input('state');
|
||||
$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->save();
|
||||
|
||||
return response()->json(['deliveryinfo'=>$deliveryinfo],201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the delivery-info.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
|
||||
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');
|
||||
$deliveryinfo->postcode = $request->input('postcode');
|
||||
$deliveryinfo->state = $request->input('state');
|
||||
$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->save();
|
||||
|
||||
return response()->json(['deliveryinfo'=>$deliveryinfo],200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the delivery-info.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
$deliveryinfo->delete($id);
|
||||
|
||||
return response()->json($deliveryinfo, 204);
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,21 @@ return [
|
||||
'engine' => null,
|
||||
],
|
||||
|
||||
'testing' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => 'testingizyim',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
|
||||
@@ -15,6 +15,9 @@ use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'password' => bcrypt(str_random(10)), // secret
|
||||
'phone' => $faker->unique()->randomDigit,
|
||||
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
|
||||
'remember_token' => str_random(10),
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDeliveryinfosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('deliveryinfos', function (Blueprint $table) {
|
||||
|
||||
$table->increments('id');
|
||||
$table->string('branch');
|
||||
$table->string('deli_info');
|
||||
$table->string('address');
|
||||
$table->string('city');
|
||||
$table->integer('postcode');
|
||||
$table->string('state');
|
||||
$table->string('country');
|
||||
$table->string('contact_person');
|
||||
$table->integer('contact_person_no');
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('deliveryinfos');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddColumnToTableDeliveryInfo extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('deliveryinfos', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('com_id');//FK wrn id
|
||||
$table->foreign('com_id')
|
||||
->references('id')->on('companies')
|
||||
->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('deliveryinfos', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CompanySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('companies')->insert([
|
||||
|
||||
'id' => '999',
|
||||
'company_name'=>'testing',
|
||||
'registration_no'=>'testing',
|
||||
'tax_no'=>'testing',
|
||||
'tel_no'=>'12345',
|
||||
'fax'=>'12345',
|
||||
'address'=>'testing',
|
||||
'city'=>'testing',
|
||||
'postcode'=>'12345',
|
||||
'state'=>'testing',
|
||||
'country'=>'testing',
|
||||
'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'
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,7 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
$this->call(LaratrustSeeder::class);
|
||||
$this->call(UsersTableSeeder::class);
|
||||
$this->call(DeliveryInfoSeeder::class);
|
||||
$this->call(CompanySeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DeliveryInfoSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('deliveryinfos')->insert([
|
||||
|
||||
'id' => '999',
|
||||
'branch' => 'Testing',
|
||||
'deli_info' => 'Testing',
|
||||
'address' => 'Testing',
|
||||
'city' => 'Test',
|
||||
'postcode' => '12345',
|
||||
'state' => 'Testing',
|
||||
'country' => 'Testing',
|
||||
'contact_person' => 'Testing',
|
||||
'contact_person_no' => '12345',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'com_id' => '999'
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,6 +27,6 @@
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
<env name="MAIL_DRIVER" value="array"/>
|
||||
<env name="DB_CONNECTION" value="testing"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
||||
Vendored
-6
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Create</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,92 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Laravel</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-weight: 100;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.position-ref {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 84px;
|
||||
}
|
||||
|
||||
.links>a {
|
||||
color: #636b6f;
|
||||
padding: 0 25px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="flex-center position-ref full-height">
|
||||
@if (Route::has('login'))
|
||||
<div class="top-right links">
|
||||
@auth
|
||||
<a href="{{ url('/home') }}">Home</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}">Login</a>
|
||||
<a href="{{ route('register') }}">Register</a>
|
||||
@endauth
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
<p2>Laravel</p2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
Hi {{ $name }},
|
||||
<br>
|
||||
Thank you for creating an account with us. Don't forget to complete your registration!
|
||||
<br>
|
||||
Please click on the link below or copy it into the address bar of your browser to confirm your email address:
|
||||
<br>
|
||||
|
||||
<a href="{{ url('user/verify', $verification_code)}}">Confirm my email address </a>
|
||||
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Laravel</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-weight: 100;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.position-ref {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 84px;
|
||||
}
|
||||
|
||||
.links > a {
|
||||
color: #636b6f;
|
||||
padding: 0 25px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex-center position-ref full-height">
|
||||
@if (Route::has('login'))
|
||||
<div class="top-right links">
|
||||
@auth
|
||||
<a href="{{ url('/home') }}">Home</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}">Login</a>
|
||||
<a href="{{ route('register') }}">Register</a>
|
||||
@endauth
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
Laravel
|
||||
</div>
|
||||
|
||||
<div class="links">
|
||||
<a href="https://laravel.com/docs">Documentation</a>
|
||||
<a href="https://laracasts.com">Laracasts</a>
|
||||
<a href="https://laravel-news.com">News</a>
|
||||
<a href="https://forge.laravel.com">Forge</a>
|
||||
<a href="https://github.com/laravel/laravel">GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,95 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Laravel</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-weight: 100;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.position-ref {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 84px;
|
||||
}
|
||||
|
||||
.links > a {
|
||||
color: #636b6f;
|
||||
padding: 0 25px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex-center position-ref full-height">
|
||||
@if (Route::has('login'))
|
||||
<div class="top-right links">
|
||||
@auth
|
||||
<a href="{{ url('/home') }}">Home</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}">Login</a>
|
||||
<a href="{{ route('register') }}">Register</a>
|
||||
@endauth
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
Laravel
|
||||
</div>
|
||||
|
||||
<div class="links">
|
||||
<a href="https://laravel.com/docs">Documentation</a>
|
||||
<a href="https://laracasts.com">Laracasts</a>
|
||||
<a href="https://laravel-news.com">News</a>
|
||||
<a href="https://forge.laravel.com">Forge</a>
|
||||
<a href="https://github.com/laravel/laravel">GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -13,6 +13,16 @@ use App\Company;
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
// return $request->user();
|
||||
//});
|
||||
|
||||
Route::post('register', 'AuthController@register');
|
||||
/* Authentication */
|
||||
Route::post('login', 'AuthController@login');
|
||||
Route::post('password/recover', 'AuthController@recover');
|
||||
@@ -27,6 +37,14 @@ Route::group(['middleware' => ['jwt.auth']], function() {
|
||||
return response()->json(['user'=> $request->user()]);
|
||||
});
|
||||
|
||||
/*Delivery-Info in profile menu*/
|
||||
Route::get('/deliveryinfo','DeliveryinfoController@index');
|
||||
Route::get('/deliveryinfo/{com_id}','DeliveryinfoController@show');
|
||||
Route::post('/deliveryinfo', 'DeliveryinfoController@store');
|
||||
Route::put('/deliveryinfo/{com_id}', 'DeliveryinfoController@update');
|
||||
Route::delete('/deliveryinfo/{com_id}', 'DeliveryinfoController@destroy');
|
||||
|
||||
|
||||
/* Company */
|
||||
Route::patch('/company', 'CompanyController@update'); //update company information
|
||||
Route::post('/company/company_profile/', 'CompanyController@companyProfile');//upload company profile picture
|
||||
|
||||
+10
-3
@@ -11,9 +11,16 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
/* Routes for the DeliveryInfo in profile*/
|
||||
// Route::get('/company/deliveryinfo','DeliveryinfoController@index');
|
||||
// Route::get('/company/{com_id}/deliveryinfo','DeliveryinfoController@show');
|
||||
|
||||
// Route::post('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@store');
|
||||
// Route::put('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@edit');
|
||||
// Route::put('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@update');
|
||||
// Route::delete('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@delete');
|
||||
|
||||
|
||||
|
||||
//Route::post('login', 'AuthController@login');
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Artisan;
|
||||
use App\User;
|
||||
use App\Company;
|
||||
use App\Deliveryinfo;
|
||||
|
||||
class DeliveryinfoTest extends TestCase
|
||||
{
|
||||
protected $company;
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->company = $this->user->each(function ($u) {
|
||||
factory(Company::class)->create([
|
||||
'user_id' => $u->id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
// TODO : those test is wrong, please redo later.
|
||||
|
||||
// public function testCreate()
|
||||
// {
|
||||
|
||||
// $response = $this->actingAs($this->company)
|
||||
// ->patchJson('/api/deliveryinfo', [
|
||||
|
||||
// 'branch' => 'Test',
|
||||
// 'deli_info' => 'Testing',
|
||||
// 'address' => 'Testing',
|
||||
// 'city' => 'Test',
|
||||
// 'postcode' => '12345',
|
||||
// 'state' => 'Testing',
|
||||
// 'country' => 'Testing',
|
||||
// 'contact_person' => 'Testing',
|
||||
// 'contact_person_no' => '12345'
|
||||
|
||||
// ]);
|
||||
|
||||
// $response->assertStatus(201);
|
||||
// }
|
||||
|
||||
|
||||
// public function testPUT()
|
||||
// {
|
||||
|
||||
// $response = $this->actingAs($this->company)
|
||||
// ->patchJson('/api/deliveryinfo', [
|
||||
|
||||
// 'branch' => 'Test',
|
||||
// 'deli_info' => 'Testing',
|
||||
// 'address' => 'Testing',
|
||||
// 'city' => 'Test',
|
||||
// 'postcode' => '12345',
|
||||
// 'state' => 'Testing',
|
||||
// 'country' => 'Testing',
|
||||
// 'contact_person' => 'Testing',
|
||||
// 'contact_person_no' => '12345'
|
||||
|
||||
// ]);
|
||||
|
||||
// $response->assertStatus(200);
|
||||
// }
|
||||
|
||||
// public function testDELETE()
|
||||
// {
|
||||
// $response = $this->json('DELETE', '/api/deliveryinfo');
|
||||
|
||||
// $response->assertStatus(204);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user