Completed
Branch develop (db0f45)
by Abhishek Kumar
08:12
created
database/migrations/2018_06_25_112242_create_exports_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('exports', function (Blueprint $table) {
16
+        Schema::create('exports', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('file', 255)->nullable();
19 19
             $table->string('type', 10);
Please login to merge, or discard this patch.
database/migrations/2018_06_15_103302_create_imports_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('imports', function (Blueprint $table) {
16
+        Schema::create('imports', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('file', 255);
19 19
             $table->integer('file_rows');
Please login to merge, or discard this patch.
database/migrations/2018_06_22_045143_create_import_export_logs_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('import_export_logs', function (Blueprint $table) {
16
+        Schema::create('import_export_logs', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->integer('op_id');
19 19
             $table->longText('data');
Please login to merge, or discard this patch.
src/Models/ImportExportLog.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     */
17 17
     public function import()
18 18
     {
19
-    	return $this->belongsTo( \Ladybirdweb\ImportExport\Models\Import::class );
19
+    	return $this->belongsTo(\Ladybirdweb\ImportExport\Models\Import::class);
20 20
     }
21 21
 
22 22
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     */
30 30
     public function getDataAttribute($value)
31 31
     {
32
-        return unserialize( $value );
32
+        return unserialize($value);
33 33
     }
34 34
 
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     */
43 43
     public function setDataAttribute($value)
44 44
     {
45
-        $this->attributes['data'] = serialize( $value );
45
+        $this->attributes['data'] = serialize($value);
46 46
     }
47 47
 
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
     public function getMessageAttribute($value)
57 57
     {
58
-        return unserialize( $value );
58
+        return unserialize($value);
59 59
     }
60 60
 
61 61
 
@@ -68,6 +68,6 @@  discard block
 block discarded – undo
68 68
     */
69 69
     public function setMessageAttribute($value)
70 70
     {
71
-        $this->attributes['message'] = serialize( $value );
71
+        $this->attributes['message'] = serialize($value);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
src/Models/Export.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Export extends Model
8 8
 {
9
-    protected $fillable = [ 'file', 'type', 'query', 'result_rows'];
9
+    protected $fillable = ['file', 'type', 'query', 'result_rows'];
10 10
 
11 11
     /**
12 12
     * Query accessor
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     */
18 18
     public function getQueryAttribute($value)
19 19
     {
20
-        return unserialize( $value );
20
+        return unserialize($value);
21 21
     }
22 22
 
23 23
 
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
     */
31 31
     public function setQueryAttribute($value)
32 32
     {
33
-        $this->attributes['query'] = serialize( $value );
33
+        $this->attributes['query'] = serialize($value);
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Models/Import.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     */
17 17
     public function importLogs()
18 18
     {
19
-    	return $this->hasMany( \Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id' );
19
+    	return $this->hasMany(\Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id');
20 20
     }
21 21
 
22 22
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     */
30 30
     public function getModelMapAttribute($value)
31 31
     {
32
-        return unserialize( $value );
32
+        return unserialize($value);
33 33
     }
34 34
 
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     */
43 43
     public function setModelMapAttribute($value)
44 44
     {
45
-        $this->attributes['model_map'] = serialize( $value );
45
+        $this->attributes['model_map'] = serialize($value);
46 46
     }
47 47
 
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
     public function getDbColsAttribute($value)
57 57
     {
58
-        return unserialize( $value );
58
+        return unserialize($value);
59 59
     }
60 60
 
61 61
 
@@ -68,6 +68,6 @@  discard block
 block discarded – undo
68 68
     */
69 69
     public function setDbColsAttribute($value)
70 70
     {
71
-        $this->attributes['db_cols'] = serialize( $value );
71
+        $this->attributes['db_cols'] = serialize($value);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
src/ImportExportServiceProvider.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@  discard block
 block discarded – undo
14 14
     public function boot()
15 15
     {
16 16
         // Register routes
17
-        $this->loadRoutesFrom( __DIR__ . '/routes.php' );
17
+        $this->loadRoutesFrom(__DIR__.'/routes.php');
18 18
 
19 19
         // Register database migrations
20
-        $this->loadMigrationsFrom( __DIR__ . '/../database/migrations' );
20
+        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
21 21
 
22 22
         // Load views
23
-        $this->loadViewsFrom( __DIR__ . '/../resources/views', 'importexport' );
23
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'importexport');
24 24
 
25 25
 
26 26
         // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'ladybirdweb');
27 27
 
28 28
         // Publishing is only necessary when using the CLI.
29
-        if ( $this->app->runningInConsole() ) {
29
+        if ($this->app->runningInConsole()) {
30 30
 
31 31
             // Publishing the configuration file.
32 32
             $this->publishes([
33
-                __DIR__ . '/../config/import.php' => config_path('ladybirdweb/import-export/import.php'),
33
+                __DIR__.'/../config/import.php' => config_path('ladybirdweb/import-export/import.php'),
34 34
             ], 'import-export.config');
35 35
             
36 36
             $this->publishes([
37
-                __DIR__ . '/../config/export.php' => config_path('ladybirdweb/import-export/export.php'),
37
+                __DIR__.'/../config/export.php' => config_path('ladybirdweb/import-export/export.php'),
38 38
             ], 'import-export.config');
39 39
 
40 40
             // Publishing the views.
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
     public function register()
59 59
     {
60 60
         // Merge config
61
-        $this->mergeConfigFrom( __DIR__ . '/../config/import.php', 'import' );
62
-        $this->mergeConfigFrom( __DIR__ . '/../config/export.php', 'export' );
61
+        $this->mergeConfigFrom(__DIR__.'/../config/import.php', 'import');
62
+        $this->mergeConfigFrom(__DIR__.'/../config/export.php', 'export');
63 63
 
64 64
         // Register fecades
65
-        $this->app->singleton( 'import', 'Ladybirdweb\ImportExport\Import' );
66
-        $this->app->singleton( 'importhandler', 'Ladybirdweb\ImportExport\ImportHandler' );
67
-        $this->app->singleton( 'importexportlog', 'Ladybirdweb\ImportExport\ImportExportLog' );
65
+        $this->app->singleton('import', 'Ladybirdweb\ImportExport\Import');
66
+        $this->app->singleton('importhandler', 'Ladybirdweb\ImportExport\ImportHandler');
67
+        $this->app->singleton('importexportlog', 'Ladybirdweb\ImportExport\ImportExportLog');
68 68
 
69
-        $this->app->singleton( 'export', 'Ladybirdweb\ImportExport\Export' );
69
+        $this->app->singleton('export', 'Ladybirdweb\ImportExport\Export');
70 70
 
71 71
         // Register import controller
72
-        $this->app->singleton( 'Ladybirdweb\ImportExport\Import' );
72
+        $this->app->singleton('Ladybirdweb\ImportExport\Import');
73 73
 
74 74
         // Register import handler
75
-        $this->app->singleton( 'Ladybirdweb\ImportExport\ImportHandler' );
75
+        $this->app->singleton('Ladybirdweb\ImportExport\ImportHandler');
76 76
         
77 77
     }
78 78
 
Please login to merge, or discard this patch.
src/ImportExportLog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 	public function getLogs($id)
21 21
 	{
22 22
 		// Get all logs of a import or export process
23
-		return Import::findOrFail( $id )->importLogs()->get( [ 'data', 'message' ] )->toArray();
23
+		return Import::findOrFail($id)->importLogs()->get(['data', 'message'])->toArray();
24 24
 	}
25 25
 
26 26
 }
Please login to merge, or discard this patch.
src/Export.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 		$export->save();
21 21
 
22
-		ExportJob::dispatch( $export )->onQueue( 'exporting' );
22
+		ExportJob::dispatch($export)->onQueue('exporting');
23 23
 
24 24
 		return $export;
25 25
 	}
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	public function showExportStatus($id)
30 30
     {
31 31
         // Map export instance
32
-        $export = ModelExport::findOrFail( $id );
32
+        $export = ModelExport::findOrFail($id);
33 33
 
34
-        return view( 'importexport::export.progress', compact( 'id' ) );
34
+        return view('importexport::export.progress', compact('id'));
35 35
     }
36 36
 
37 37
 
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
     public function returnExportProgress($id)
45 45
     {
46 46
         // Map export instance
47
-        $export = ModelExport::findOrFail( $id );
47
+        $export = ModelExport::findOrFail($id);
48 48
 
49 49
         $data['status'] = 200;
50 50
 
51
-        if ( $export->result_rows > 0 ) {
51
+        if ($export->result_rows > 0) {
52 52
 
53
-        	$data['progress'] = round( ( $export->row_processed / $export->result_rows ) * 100 );
53
+        	$data['progress'] = round(($export->row_processed / $export->result_rows) * 100);
54 54
 
55 55
         } else {
56 56
 
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
         }
60 60
 
61 61
         // If progress completed return successful imported rows count
62
-        if ( $data['progress'] == 100 ) {
63
-            $data['exported'] = route( 'ladybirdweb.export.download', $export->id );
62
+        if ($data['progress'] == 100) {
63
+            $data['exported'] = route('ladybirdweb.export.download', $export->id);
64 64
         }
65 65
 
66
-        return response()->json( $data );
66
+        return response()->json($data);
67 67
     }
68 68
 
69 69
 
70 70
     public function downloadExportedFile($id)
71 71
     {
72 72
         // Map export instance
73
-        $export = ModelExport::findOrFail( $id );
73
+        $export = ModelExport::findOrFail($id);
74 74
 
75
-        if ( ! file_exists( storage_path( 'app/exports' ) . '/' . $export->file ) || empty( $export->file ) ) {
75
+        if (!file_exists(storage_path('app/exports').'/'.$export->file) || empty($export->file)) {
76 76
             abort(404);
77 77
         }
78 78
 
79
-        return response()->download( storage_path( 'app/exports/' . $export->file ) );
79
+        return response()->download(storage_path('app/exports/'.$export->file));
80 80
     }
81 81
 }
Please login to merge, or discard this patch.