added image upload for wrn

This commit is contained in:
Zain Fauzan Rofie Azizi
2018-05-23 11:19:13 +08:00
parent cbcd538eda
commit d140ecf10f
4 changed files with 599 additions and 137 deletions
@@ -57,7 +57,7 @@ class WarehousearrangementController extends Controller
//validaating file types
$validator = Validator::make($request->all(), [
'warehouse_picture' => 'image|mimes:jpg,jpeg,bmp,png'
'image' => 'image|mimes:jpg,jpeg,bmp,png'
]);
if($validator->fails())
@@ -65,20 +65,20 @@ class WarehousearrangementController extends Controller
return "failed";
}
if($file = $request->file('warehouse_picture')) //warehouse picture
if($file = $request->file('image')) //warehouse picture
{
$warehouse_picture = $request->file('warehouse_picture');
$filename = $warehouse_picture->getClientOriginalName(); //get the original file name
$unique_name = 'comp_prof_' . md5($filename. time()); //generating a random file name
$image = $request->file('image');
$filename = $image->getClientOriginalName(); //get the original file name
$unique_name = 'warehouse_picture_' . md5($filename. time()); //generating a random file name
$file = $request->file('warehouse_picture');
$file = $request->file('image');
$ext = $file->getClientOriginalExtension();
$input['warehouse_picture'] = $filename;
$input['image'] = $filename;
Storage::putFileAs(
'warehouse_picture',/*folder name*/ $file, $unique_name. '.' .$ext
);
$warehousearr->warehouse_picture = $unique_name. '.' .$ext;
$warehousearr->image = $unique_name. '.' .$ext;
} //end if
+4 -2
View File
@@ -9,14 +9,16 @@
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"tymon/jwt-auth": "dev-develop"
"tymon/jwt-auth": "dev-develop",
"doctrine/dbal": "v2.7.1"
},
"require-dev": {
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^7.0",
"doctrine/dbal": "v2.7.1"
},
"autoload": {
"classmap": [
Generated
+541 -127
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableToWarehousearrsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('warehousearrs', function (Blueprint $table) {
// $table->increments('id');
// $table->unsignedInteger('so_id');//FK shipping order id
// $table->foreign('so_id')
// ->references('id')->on('sos')
// ->onDelete('cascade');
// $table->date('receive_on');
// $table->string('transport_company_name');
// $table->integer('consignment_note_no');
// $table->integer('warehouse_receive_note_no');
// $table->string('receiving_person');
// $table->integer('marking_number');
$table->string('image')->nullable()->change();
// $table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('warehousearrs', function (Blueprint $table) {
//
});
}
}