Skip to content

Instantly share code, notes, and snippets.

View sadhakbj's full-sized avatar

Bijaya Prasad Kuikel sadhakbj

View GitHub Profile
@sadhakbj
sadhakbj / App.js
Last active November 5, 2024 13:32
Data table component with Laravel & React JS
import React from "react";
import DataTable from "./DataTable";
const App = () => {
return (
<div className="card">
<div className="card-header">Users</div>
<div className="card-body">
<DataTable
@sadhakbj
sadhakbj / App.tsx
Last active May 5, 2021 05:28
App.tsx
import React, { useState } from "react";
export interface IUser {
name: string;
age: number;
}
const App = () => {
const [users, setUsers] = useState<IUser[]>([
{
name: "Bijaya",
@sadhakbj
sadhakbj / LaravelPagination.vue
Created April 18, 2020 05:55
Pagination with laravel and vue
<template>
<nav v-if="pagination">
<ul class="pagination">
<li class="page-item" :class="{'disabled' : pagination.currentPage === 1}">
<a class="page-link" href="#" @click.prevent="changePage(pagination.currentPage - 1)">Previous</a>
</li>
<li v-for="page in pagesNumber" class="page-item"
:class="{'active': page == pagination.current_page}">
<a href="javascript:void(0)" @click.prevent="changePage(page)" class="page-link">{{ page }}</a>
</li>
@sadhakbj
sadhakbj / AppServiceProvider.php
Created January 28, 2020 12:38 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@sadhakbj
sadhakbj / .php_cs
Last active November 26, 2023 09:15
My optimized settings for vscode php cs fixer
<?php
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->name('*.php')
->notName('_ide_helper.php')
->notName('*.blade.php')
->notPath('bootstrap')
->notPath('node_modules')
->notPath('storage')
@sadhakbj
sadhakbj / DataTable.vue
Created November 23, 2018 05:14
Datable.vue ep-2
<template>
<div class="data-table">
<div class="main-table">
<table class="table">
<thead>
<tr>
<th class="table-head">#</th>
<th v-for="column in columns" :key="column" @click="sortByColumn(column)"
class="table-head">
{{ column | columnHead }}
@sadhakbj
sadhakbj / UsersController.php
Created November 23, 2018 05:13
Vue-datatable-ep2-UsersController
<?php
namespace App\Http\Controllers;
use App\Http\Resources\UsersResource;
use App\User;
use Illuminate\Http\Request;
/**
* Class UsersController
@sadhakbj
sadhakbj / welcome.blade.php
Created November 20, 2018 08:59
Data Table -1 - welcome
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Laravel</title>
<link rel="stylesheet" href="{{ asset('css/app.css') }}"/>
</head>
@sadhakbj
sadhakbj / app.js
Created November 20, 2018 08:56
Datatable-1-app.js
require('./bootstrap')
import Vue from 'vue'
window.Vue = Vue
import DataTable from './components/DataTable'
const app = new Vue({
el: '#app',
components: {
DataTable
@sadhakbj
sadhakbj / DataTable.vue
Created November 20, 2018 08:54
Datatable1- Datatable.vue
<template>
<div class="data-table">
<table class="table">
<thead>
<tr>
<th class="table-head">#</th>
<th v-for="column in columns" :key="column"
class="table-head">
{{ column | columnHead }}
</th>