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);
}
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
});
jika laravel di ubuntu hanya bisa akses public saja,,
solusi:
sudo chmod 777 /direktori laravel
sudo a2enmod rewrite
trus restart apache: sudo service apache2 restart