diff --git a/Dockerfile b/Dockerfile index f78c24a..4c4eaed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ FROM php:7 + +WORKDIR /app +COPY . /app + RUN apt-get update -y && apt-get install -y openssl zip unzip git RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN docker-php-ext-install pdo pdo_mysql -WORKDIR /app -COPY . /app RUN composer install CMD php artisan serve --host=0.0.0.0 --port=8000 EXPOSE 8000 \ No newline at end of file diff --git a/app/Company.php b/app/Company.php new file mode 100644 index 0000000..af4bf8d --- /dev/null +++ b/app/Company.php @@ -0,0 +1,12 @@ +get(); + return response()->json($matchedTerm); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + //$company = new Company; + // if($request->hasFile('avatar')) + // { + // $avatar = $request->file('avatar'); + // $filename = time() . '.' . $avatar->getClientOriginalExtension(); + // Image::make($avatar)->resize(300,300)->save(public_path('/uploads/company_profile/'.$filename)); + // } + // else + // { + // return response()->json(['message'=>'Document not found']); + // } + $input = $request->all(); + + //validating uploaded files + // $this->validate(request(),[ + // 'company_profile' => 'required|image|mimes:jpg,jpeg,bmp,png', + // 'reg_cerf' => 'required|mimes:jpg,jpeg,bmp,png,gif,svg,pdf' + // ]); + + if($file = $request->file('company_profile')) //company profile picture + { + $company_profile = $request->file('company_profile'); + $filename = $company_profile->getClientOriginalName(); + //$destinationPath = config('app.fileDestinationPath').'/'.$filename; + + $file = $request->file('company_profile'); + $ext = $file->getClientOriginalExtension(); + + Storage::putFileAs( + 'company_profile',/*folder name*/ $file, $filename. '.' .$ext + ); + + // $name = $file->getClientOriginalName(); + // $img_file = $request->file('company_profile'); + // Image::make($img_file)->resize(300,300)->save(public_path('\company_profile')); + // //return $img_file; + // // $file->move('uploads/company_profile/', $img_file); + + // $input['company_profile'] = $name; + } + + if($request->hasFile('reg_cert')) //Registration Certificate upload + { + $reg_cert = $request->file('reg_cert'); + $filename = $reg_cert->getClientOriginalName(); + //$destinationPath = config('app.fileDestinationPath').'/'.$filename; + + $file = $request->file('reg_cert'); + $ext = $file->getClientOriginalExtension(); + + Storage::putFileAs( + 'reg_cert',/*folder name*/ $file, $filename. '.' .$ext + ); + + // $uploaded = Storage::put($destinationPath, file_get_contents($reg_cert->getRealPath())); + // $name = $file->getClientOriginalName(); + // $img_file = $request->file('reg_cert'); + // Image::make($img_file)->save(public_path('uploads\reg_cert')); + + // $input['company_profile'] = $name; + // $request->file('req_cert'); + // //$request->image->store('\uploads\reg_cert'); + // Storage::putFile('uploads\reg_cert', $request->file('reg_cert')); + } + // else{ + // return "failed"; + // } + Company::create($input); + //Company::create(request()->all()); + //dd(request()->all()); + return redirect('/'); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + $company = Company::find($id); + if (!$company) + { + return response()->json(['message'=>'Document not found'],200); + } + //updating company profile picture + if($file = $request->file('company_profile')) //company profile picture + { + $company_profile = $request->file('company_profile'); + $filename = $company_profile->getClientOriginalName(); + //$destinationPath = config('app.fileDestinationPath').'/'.$filename; + + $file = $request->file('company_profile'); + $ext = $file->getClientOriginalExtension(); + + Storage::putFileAs( + 'company_profile',/*folder name*/ $file, $filename. '.' .$ext + ); + } + + //updating registration certificate + if($request->hasFile('reg_cert')) //Registration Certificate upload + { + $reg_cert = $request->file('reg_cert'); + $filename = $reg_cert->getClientOriginalName(); + //$destinationPath = config('app.fileDestinationPath').'/'.$filename; + + $file = $request->file('reg_cert'); + $ext = $file->getClientOriginalExtension(); + + Storage::putFileAs( + 'reg_cert',/*folder name*/ $file, $filename. '.' .$ext + ); + } + + $company->company_name=$request->input('company_name'); + $company->registration_no=$request->input('registration_no'); + $company->tax_no=$request->input('tax_no'); + $company->tel_no=$request->input('tel_no'); + $company->fax=$request->input('fax'); + $company->address=$request->input('address'); + $company->city=$request->input('city'); + $company->postcode=$request->input('postcode'); + $company->state=$request->input('state'); + $company->country=$request->input('country'); + $company->contact_person=$request->input('contact_person'); + $company->save(); + return response()->json(['warehouse'=>$company],200); + // $product = Company::findOrFail($productId); + // $product->update($request->all()); + // $product->company_name = 'imagepath'; + // $product->save(); + + //return response()->json($product, 200); + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } + + public function uploadImage($request) + { + // if($request->hasFile('avatar')) + // { + // $avatar = $request->file('avatar'); + // $filename = time() . '.' . $avatar->getClientOriginalExtension(); + // Image::make($avatar)->resize(300,300)->save(public_path('/uploads/company_profile/'.$filename)); + // } + } +} \ No newline at end of file diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index a74a792..26e20b9 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -32,16 +32,9 @@ class ContactController extends Controller { // } - public function searchContact($id) - { - $matchedTerm = Breed::where('ff_id', 'LIKE', $id . '%')->get(); - return response()->json($matchedTerm); - } - - /** * Store a newly created resource in storage. * @@ -50,8 +43,21 @@ class ContactController extends Controller */ public function store(Request $request) { - $contact = Contact::create($request->all()); - // $contact->created=true; + // get company id from request ex: $request->input('company_id') + // $company_id = $request->input('company_id')) + + // query to find company asisng to $company + // $company = Comapny::find($company_id) + + // get user from session $request->user(); + // $user = $request->user(); + + // prepare query + + + // insert into database + + return response()->json($contact, 201); } diff --git a/composer.json b/composer.json index 9b16a71..2443b2c 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,9 @@ "type": "project", "require": { "php": "^7.1.3", + "doctrine/dbal": "^2.7", "fideloper/proxy": "^4.0", + "intervention/image": "^2.4", "laravel/framework": "5.6.*", "laravel/tinker": "^1.0", "tymon/jwt-auth": "dev-develop" diff --git a/composer.lock b/composer.lock index 409adc3..f304a85 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f2d9e6ec1c09918f1f3130aa31e04472", + "content-hash": "ad4497779e1657228811439be2faf961", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -39,6 +39,363 @@ "description": "implementation of xdg base directory specification for php", "time": "2014-10-24T07:27:01+00:00" }, + { + "name": "doctrine/annotations", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-12-06T07:11:42+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-08-25T07:02:50+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-07-22T10:37:32+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/f68c297ce6455e8fd794aa8ffaf9fa458f6ade66", + "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~7.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-08-31T08:43:38+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.7.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "11037b4352c008373561dc6fc836834eed80c3b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/11037b4352c008373561dc6fc836834eed80c3b5", + "reference": "11037b4352c008373561dc6fc836834eed80c3b5", + "shasum": "" + }, + "require": { + "doctrine/common": "^2.7.1", + "ext-pdo": "*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^4.0", + "phpunit/phpunit": "^7.0", + "phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5", + "symfony/console": "^2.0.5||^3.0", + "symfony/phpunit-bridge": "^3.4.5|^4.0.5" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2018-04-07T18:44:18+00:00" + }, { "name": "doctrine/inflector", "version": "v1.3.0", @@ -366,6 +723,141 @@ ], "time": "2018-02-07T20:20:57+00:00" }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, + { + "name": "intervention/image", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "3603dbcc9a17d307533473246a6c58c31cf17919" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/3603dbcc9a17d307533473246a6c58c31cf17919", + "reference": "3603dbcc9a17d307533473246a6c58c31cf17919", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "time": "2017-09-21T16:29:17+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "0.1", @@ -1139,6 +1631,56 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "1.0.2", diff --git a/config/app.php b/config/app.php index 3dc5bca..849a78f 100644 --- a/config/app.php +++ b/config/app.php @@ -1,7 +1,7 @@ 'uploads', /* |-------------------------------------------------------------------------- | Application Name @@ -159,7 +159,7 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - + Intervention\Image\ImageServiceProvider::class ], /* @@ -210,7 +210,7 @@ return [ 'View' => Illuminate\Support\Facades\View::class, 'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class, 'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class, - + 'Image' => Intervention\Image\Facades\Image::class ], ]; diff --git a/config/database.php b/config/database.php index cab5d06..af32da1 100644 --- a/config/database.php +++ b/config/database.php @@ -43,7 +43,7 @@ return [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), + 'database' => env('DB_DATABASE', 'forgzze'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), diff --git a/database/migrations/2018_04_24_034401_create_companies_table.php b/database/migrations/2018_04_24_034401_create_companies_table.php new file mode 100644 index 0000000..2489520 --- /dev/null +++ b/database/migrations/2018_04_24_034401_create_companies_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->string('company_profile');//->default('default.jpg'); //need to check about storage type + $table->string('reg_cert'); + $table->string('company-name'); + $table->string('registration-no'); + $table->string('tax-no'); + $table->integer('tel-no'); + $table->integer('fax'); + $table->string('address'); + $table->string('city'); + $table->string('postcode'); + $table->string('state'); + $table->string('country'); + $table->string('contact-person'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('companies'); + } +} diff --git a/database/migrations/2018_04_25_083636_rename_column_in_company.php b/database/migrations/2018_04_25_083636_rename_column_in_company.php new file mode 100644 index 0000000..b2f3f0d --- /dev/null +++ b/database/migrations/2018_04_25_083636_rename_column_in_company.php @@ -0,0 +1,35 @@ +renameColumn('company-profile', 'company_profile'); + $table->renameColumn('"company-name"', 'company_name'); + $table->renameColumn('"registration-no"', 'registration_no'); + $table->renameColumn('"tax-no"', 'tax_no'); + $table->renameColumn('"tel-no"', 'tel_no'); + $table->renameColumn('"contact-person"', 'contact_person'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_04_30_082838_create_contacts_table.php b/database/migrations/2018_05_14_022103_create_contacts_table.php similarity index 52% rename from database/migrations/2018_04_30_082838_create_contacts_table.php rename to database/migrations/2018_05_14_022103_create_contacts_table.php index 8146118..a1599b2 100644 --- a/database/migrations/2018_04_30_082838_create_contacts_table.php +++ b/database/migrations/2018_05_14_022103_create_contacts_table.php @@ -15,7 +15,19 @@ class CreateContactsTable extends Migration { Schema::create('contacts', function (Blueprint $table) { $table->increments('id'); - $table->integer('ff_id')->unique(); + $table->integer('user_id')->unsigned(); + $table->foreign('user_id') + + ->references('id')->on('users') + ->onDelete('cascade'); + //$table->unsignedInteger('user_id'); + + // $table->foreign('user_id')->references('id')->on('users'); + $table->integer('company_id')->unsigned(); + $table->foreign('company_id') + ->references('id')->on('companies') + ->onDelete('cascade'); + $table->Integer('status')->default('0'); $table->timestamps(); }); } diff --git a/public/company_profile b/public/company_profile new file mode 100644 index 0000000..470ac4c Binary files /dev/null and b/public/company_profile differ diff --git a/public/uploads/company_profile/hello.jpg b/public/uploads/company_profile/hello.jpg new file mode 100644 index 0000000..470ac4c Binary files /dev/null and b/public/uploads/company_profile/hello.jpg differ diff --git a/public/uploads/reg_cert/reg_cert.jpg b/public/uploads/reg_cert/reg_cert.jpg new file mode 100644 index 0000000..470ac4c Binary files /dev/null and b/public/uploads/reg_cert/reg_cert.jpg differ diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/routes/api.php b/routes/api.php index 9b8c68a..96683eb 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,7 +1,7 @@ user(); //}); -//Route::post('register', 'AuthController@register'); -//Route::post('login', 'AuthController@login'); +Route::post('register', 'AuthController@register'); +Route::post('login', 'AuthController@login'); //Route::post('recover', 'AuthController@recover'); // //Route::group(['middleware' => ['jwt.auth']], function() { @@ -34,7 +34,33 @@ Route :: put('/warehouse/{war_id}','WarehouseController@update'); Route :: get('/warehouse','WarehouseController@index'); + Route :: delete('/contacts/{ff_id}','ContactController@destroy'); Route :: get('/contacts','ContactController@index'); Route :: post('/contacts','ContactController@store'); -Route::get('/company/search/{name}', 'CompanyController@searchContact'); \ No newline at end of file + +Route::group(['middleware' => ['jwt.auth']], function() { + Route::get('logout', 'AuthController@logout'); + Route::get('test', function(){ + return response()->json(['foo'=>'bar']); + }); +}); + +Route::post('/company', 'CompanyController@store'); //store company information +Route::put('/company/{company}', 'CompanyController@update'); //update company information +Route::get('/company/search/{company_name}', 'CompanyController@search'); + +//Route::post('/company', 'CompanyController@uploadImage'); + +// Route::put('company/{}', function(Request $request, $productId) { +// $product = Company::findOrFail($productId); +// $product->update($request->all()); +// return $product; +// }); + +// Route::put('company/{}', function(Request $request, $companyId) { +// $company = Product::findOrFail($companyId); +// $company->update($request->all()); +// return $company; +// }); + diff --git a/routes/web.php b/routes/web.php index 829e44a..9fbc7a2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -17,3 +17,5 @@ Route::get('/', function () { Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request'); Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset'); + +Route::get('/company', 'CompanyController@index'); diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/storage/app/public/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore