Skip to content

Instantly share code, notes, and snippets.

View zhanang19's full-sized avatar
🏠
Working from home

Zainal Hasan zhanang19

🏠
Working from home
View GitHub Profile
@zhanang19
zhanang19 / README.md
Created July 29, 2020 02:28
Browser Console Warning

Browser Console Warning

There is so many user that don't know what is browser console. An attacker can steal an information from their account by injecting a malicious javascript. By using this script, developer can easily give a warning for user on the browser console.

@zhanang19
zhanang19 / laravel-order-by-relationship-aggregates-column.php
Created July 26, 2020 03:03
Laravel order by relationship aggregates example
<?php
$popularSerials = Serial::addSelect([
'total_views' => Video::selectRaw('sum(views) as total_views')
->whereColumn('serial_id', 'serials.id')
->groupBy('serial_id')
])
->orderBy('total_views')
->get();
@zhanang19
zhanang19 / ForceHttpsServiceProvider.php
Created July 22, 2020 23:49
Force url generator in Laravel to use HTTPS scheme
<?php
namespace App\Providers;
use Illuminate\Routing\UrlGenerator;
use Illuminate\Support\ServiceProvider;
class ForceHttpsServiceProvider extends ServiceProvider
{
/**
[program:laravelscraper]
process_name=%(program_name)s
command=php /var/www/manga.zhanang.id/artisan queue:work --tries=3
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/www/manga.zhanang.id/storage/logs/scraper.log
<html>
<head>
<style>
.gambar {
background-image: url('https://picsum.photos/200');
height: 200px;
width: 100%;
}
</style>
</head>
@zhanang19
zhanang19 / README.md
Last active May 30, 2020 13:18
Tailwind + Laravel Mix setup

Tailwind + Laravel Mix Setup

This is a gist to setup TailwindCSS on your Laravel project. Give me an advice if you have a better idea about this.

How to Use

  • Copy and compare this file to your Laravel project
  • Run yarn run dev:css to build dev version
  • Run yarn run build:css to build production-ready version

Donate

<?php
namespace Gazeboin\Event\Domain\Services;
use Gazeboin\Event\Domain\Entities\EventEntity;
use Gazeboin\Event\Domain\Entities\EventAttemptEntity;
class AttemptEventService
{
public function attempt($eventId, $data)
<?php
namespace Gazeboin\Event\Domain\Entities;
use Illuminate\Database\Eloquent\Model;
class EventEntity extends Model
{
protected $table = 'events';
<?php
namespace App\Http\Controllers\API\V1;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Gazeboin\Event\Domain\Services\AttemptEventService;
use Gazeboin\Event\Domain\Entities\EventEntity;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
    app/
        Console/
        Events/
        Exceptions/
            CustomException.php
        Gazeboin/
            src/
                Event/
                    Application/