Pivot Tabel Absen Finger print

23:12 Unknown 0 Comments

Membuat Pivot dari data absen finger

jika kita punya data absen finger seperti di bawah



lalu kita buat syntax sql nya

select no_absen,
  max(case when rownum = 1 then checktime end) Date1,
  max(case when rownum = 2 then checktime end) Date2,
  max(case when rownum = 3 then checktime end) Date3,
  max(case when rownum = 4 then checktime end) Date4
from(
select absenfinger.no_absen,
    absenfinger.checktime,
    @row:=if(@prev=date_format(absenfinger.checktime,'%Y-%m-%d'), @row,0) + 1 as rownum,
    @prev:=date_format(absenfinger.checktime,'%Y-%m-%d') as date
  from absenfinger JOIN rencanakerja ON absenfinger.no_absen = rencanakerja.no_absen,(SELECT @row:=0, @prev:=null) r
  WHERE date_format(absenfinger.checktime,'%Y-%m-%d')=date_format(rencanakerja.tanggal,'%Y-%m-%d')
    )s
    GROUP BY date
  order by no_absen, checktime

ini baru pivot static belum dinamis bray..





















0 comments:

parsing variabel php bertipe data string ke java script lewat onclick

23:54 Unknown 0 Comments

parsing variabel php bertipe data string ke java script lewat onclick

gunakan ini

echo '<div><span id="anything" onclick="updatePos(\''.$ratelink.'\')">Save</div>';

0 comments:

Project Laravel 404 notfound di ubuntu

22:59 Unknown 0 Comments

saat memindahkan project laravel dari windows ke ubuntu dan buat virtual host..
yang muncul hanya halaman utama saja dan tidak bisa akses ke url lain padahal route sudah ada..

Not Found

The requested URL /sim was not found on this server.

Apache/2.4.18 (Ubuntu) Server at localhost Port 80

caranya di virtual host yang anda buat ubah jadi seperti ini..

<Directory /var/www/html/public> <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory>

dan pastikan sudah jalankan command a2enmod rewrite

0 comments:

18:55 Unknown 0 Comments

jika laravel error InvalidArgumentException in FileViewFinder.php line 137: View [welcome] not found.

kemungkinan view tidak ada atau

tambah ini di routes

Route::get('/cmd', function () {
    chdir('../');
    $dir =  getcwd();
    print_r($dir);
    $cmd = shell_exec ('php artisan cache:clear');
    return $cmd;
});

0 comments:

membuat halaman 404 di laravel 5

18:04 Unknown 0 Comments

pertama buka file app/Exception/Handler.php 
tambahkan use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

dan function

public function render($request, Exception $e) { if($e instanceof NotFoundHttpException) { return response()->view('404', [], 404); } return parent::render($request, $e); }

0 comments:

membuat lougout tidak bisa di back di laravel

18:03 Unknown 0 Comments

pertama...

buat middleware

di sini saya buat NoCache Middleware...

>>php artisan make:middleware NoCacheMiddleware

tambah kan fungsi seperti di bawah

>>
 public function handle($request, Closure $next)
    {
     
        $response = $next($request);
        $response->headers->set('Cache-Control','nocache, no-store, max-age=0, must-revalidate');
        $response->headers->set('Pragma','no-cache');
        $response->headers->set('Expires','Fri, 01 Jan 1990 00:00:00 GMT');
        return $response;
   

    }

jika sudah ke tahap 2..
register middleware yg tadi di buat ke kernel.php

'nocache'=>\App\Http\Middleware\NoCacheMiddleware::class,
    ];

nocache adalah nama/alias midlleware yg saya buat.. (bebas namanya tdak sama dengan middleware juga ga papa)..

yg terakhir masukan middleware ke routes..

>>Route::group(['middleware' => ['web','auth','nocache']], function () {
   
     simpan semua route di sini yg udah login

});

0 comments: