Skip to content

Instantly share code, notes, and snippets.

View rootchips's full-sized avatar
🌴
On vacation

Roslan Saidi rootchips

🌴
On vacation
View GitHub Profile
@rootchips
rootchips / DataController.php
Last active July 12, 2024 13:20
How to use cache
// Using Redis + Cache replacement for laravel
// composer require swayok/alternative-laravel-cache
//
<?php
namespace App\Http\Controllers;
use App\Models\Data;
use Illuminate\Http\Request;
@rootchips
rootchips / table.vue
Last active October 10, 2023 02:04
Table with Pagination
<template>
<!-- Table -->
<div class="relative overflow-x-auto shadow-md sm:rounded-lg mt-4 ring-1 ring-black ring-opacity-5 ">
<table
class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto min-w-full divide-y divide-gray-300 dark:divide-gray-700">
<thead class="text-xs text-gray-600 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-300">
<tr class="hover:bg-gray-50 dark:hover:bg-gray-600">
<th scope="col" class="p-4">
#
</th>
@rootchips
rootchips / pagination.vue
Created October 10, 2023 01:49
Pagination
<template>
<nav v-if="pagination && pagination.totalItems" class="flex items-center justify-between pt-4" aria-label="Table navigation">
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">Showing <span
class="font-semibold text-gray-900 dark:text-white">{{ pagination?.startIndex + 1 }} - {{ pagination?.endIndex + 1
}}</span> of <span class="font-semibold text-gray-900 dark:text-white">{{ pagination?.totalItems }}</span></span>
<ul class="inline-flex items-center -space-x-px">
<li>
<a href="#"
@click="pagination?.currentPage !== pagination?.startPage ? setPage(pagination?.currentPage - 1) : $event.preventDefault()"
:class="{ 'z-10 px-3 py-2 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white' : pagination?.currentPage ===
@rootchips
rootchips / generate.php
Last active August 9, 2023 03:24
PHP Generator
php
<?php
namespace App\Process;
use App\Models\Model;
class Generate
{
//index
<div class="form-group mb-2">
<span v-for="(question, index) in questions.questions">
<p><li>{{ question.en }}</li></p>
<div class="rating">
<input type="radio" :id="'star-' + index + '-5'" v-model="question.value" :value="5" />
<label class="star" :for="'star-' + index + '-5'" title="Awesome" aria-hidden="true"></label>
<input type="radio" :id="'star-' + index + '-4'" v-model="question.value" :value="4" />
<label class="star" :for="'star-' + index + '-4'" title="Great" aria-hidden="true"></label>
@rootchips
rootchips / app.html
Created May 21, 2020 02:25
app.html
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'PE Mall') }}</title>
.class1 {
@charset "UTF-8";
/*!
* Bootstrap v4.5.0 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors
* Copyright 2011-2020 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
@rootchips
rootchips / permission.sh
Last active March 21, 2019 12:54
www-data permission
[root@chips:~]# chown -R www-data:www-data .
[root@chips:~]# find . -type f -exec chmod 644 {} \;
[root@chips:~]# find . -type d -exec chmod 755 {} \;
[root@chips:~]# chgrp -R www-data storage bootstrap/cache
[root@chips:~]# chmod -R ug+rwx storage bootstrap/cache