Roberto Santini 3 anni fa
parent
commit
45454522dc

+ 1
- 1
app/Http/Controllers/UserController.php Vedi File

@@ -27,7 +27,7 @@ class UserController extends Controller{
27 27
 
28 28
     $sign_path_tecnico = 'sign_tecnico_'.time().'.png';
29 29
     $encoded_image = explode(",", $request->signature_image_tecnico)[1];
30
-    $user->firma = base64_decode($encoded_image);
30
+    $user->firma = pg_escape_bytea($encoded_image);
31 31
     $user->save();
32 32
 
33 33
     Session::flash('flash_message', 'Profilo aggiornato');

+ 13
- 13
app/Models/AbstractModels/AbstractUser.php Vedi File

@@ -10,37 +10,37 @@ use Illuminate\Database\Eloquent\Model;
10 10
 
11 11
 abstract class AbstractUser extends Model
12 12
 {
13
-    /**  
13
+    /**
14 14
      * The table associated with the model.
15
-     * 
15
+     *
16 16
      * @var string
17 17
      */
18 18
     protected $table = 'user';
19
-    
20
-    /**  
19
+
20
+    /**
21 21
      * Primary key type.
22
-     * 
22
+     *
23 23
      * @var string
24 24
      */
25 25
     protected $keyType = 'bigInteger';
26
-    
27
-    /**  
26
+
27
+    /**
28 28
      * The attributes that should be cast to native types.
29
-     * 
29
+     *
30 30
      * @var array
31 31
      */
32 32
     protected $casts = [
33 33
         'id' => 'integer',
34 34
         'redmine_id' => 'integer',
35 35
         'azienda_id' => 'integer',
36
-        'firma' => 'string',
36
+        // 'firma' => 'string',
37 37
         'created_at' => 'datetime',
38 38
         'updated_at' => 'datetime'
39 39
     ];
40
-    
41
-    /**  
40
+
41
+    /**
42 42
      * The attributes that are mass assignable.
43
-     * 
43
+     *
44 44
      * @var array
45 45
      */
46 46
     protected $fillable = [
@@ -51,7 +51,7 @@ abstract class AbstractUser extends Model
51 51
         'created_at',
52 52
         'updated_at'
53 53
     ];
54
-    
54
+
55 55
     public function azienda()
56 56
     {
57 57
         return $this->belongsTo('\App\Models\Azienda', 'azienda_id', 'id');

+ 15
- 11
database/seeders/ConfigSeeder.php Vedi File

@@ -4,6 +4,7 @@ namespace Database\Seeders;
4 4
 
5 5
 use Illuminate\Database\Seeder;
6 6
 use App\Models\Config;
7
+use App\Models\Azienda;
7 8
 
8 9
 class ConfigSeeder extends Seeder
9 10
 {
@@ -15,17 +16,20 @@ class ConfigSeeder extends Seeder
15 16
   public function run()
16 17
   {
17 18
     // Configurazione
18
-    foreach(Config::getConfig() as $key => $group){
19
-      $order = 1;
20
-      foreach($group as $key2 => $c){
21
-        $config = Config::find($c['key']);
22
-        if($config == null){
23
-          $config = new Config;
24
-          $config->fill($c);
25
-          $config->order = $order;
26
-          $config->group = $key;
27
-          $config->save();
28
-          $order++;
19
+    foreach(Azienda::all() as $azienda){
20
+      foreach(Config::getConfig() as $key => $group){
21
+        $order = 1;
22
+        foreach($group as $key2 => $c){
23
+          $config = Config::where([['key', $c['key']], ['azienda_id', $azienda->id]])->first();
24
+          if($config == null){
25
+            $config = new Config;
26
+            $config->fill($c);
27
+            $config->azienda_id = $azienda->id;
28
+            $config->order = $order;
29
+            $config->group = $key;
30
+            $config->save();
31
+            $order++;
32
+          }
29 33
         }
30 34
       }
31 35
     }

+ 1
- 1
resources/views/components/application-logo.blade.php Vedi File

@@ -1,5 +1,5 @@
1 1
 @if(session('azienda') != null && session('azienda')->path_logo != null)
2 2
 <img src="{{ Storage::disk('azienda')->url(session('azienda')->path_logo) }}" {{ $attributes }}/>
3 3
 @else
4
-<img src="{{ assets('logo_rm.png') }}" {{ $attributes }}/>
4
+<img src="{{ asset('logo_rm.png') }}" {{ $attributes }}/>
5 5
 @endif

+ 1
- 1
resources/views/issue/pdf.blade.php Vedi File

@@ -76,7 +76,7 @@
76 76
       <div style="height: 130px; width: 100%; position: fixed; left: 0; bottom: 0px;">
77 77
         <div class="box_sx">
78 78
           <h2>Firma tecnico</h2>
79
-          <img src="data:image/png;base64,{{ chunk_split(base64_encode($firmaTecnico)) }}" style="width: 80%"/>
79
+          <img src="data:image/png;base64,{!! stream_get_contents($firmaTecnico) !!}" style="width: 80%"/>
80 80
         </div>
81 81
         <div class="box_dx">
82 82
           <h2>Firma cliente</h2>

+ 4
- 1
resources/views/user/profilo.blade.php Vedi File

@@ -2,6 +2,9 @@
2 2
 use App\Models\Config;
3 3
 use App\Models\Issue;
4 4
 
5
+
6
+// dd(stream_get_contents($user->firma));
7
+
5 8
 ?>
6 9
 <x-app-layout>
7 10
   <x-slot name="header">
@@ -44,7 +47,7 @@ use App\Models\Issue;
44 47
               @else
45 48
               {!! Form::label('', 'Firma salvata', ['style' => 'display: inline']) !!}
46 49
               <button type="submit" class="btn btn-sm btn-danger" name='elimina_firma'><i class="fas fa-trash"></i>Elimina</button>
47
-              <img src="data:image/png;base64,{{ chunk_split(base64_encode($user->firma)) }}" />
50
+              <img src="data:image/png;base64,{!! stream_get_contents($user->firma) !!}" />
48 51
               @endif
49 52
             </div>
50 53
           </div>

Loading…
Annulla
Salva