Skip to content

Instantly share code, notes, and snippets.

View skadimoolam's full-sized avatar
💻
Check out BestOfLaravel.com

Adi SK skadimoolam

💻
Check out BestOfLaravel.com
View GitHub Profile
வணக்கம், உழவர்புமிக்கு வருக.
தங்கள் ஆடர் சற்று நேரத்தில் உங்களை வந்தடையும்.
public function index(Request $request)
{
$sortBy = 'id';
$orderBy = 'desc';
$perPage = 20;
$q = null;
if ($request->has('orderBy')) $orderBy = $request->query('orderBy');
if ($request->has('sortBy')) $sortBy = $request->query('sortBy');
if ($request->has('perPage')) $perPage = $request->query('perPage');
@tailwind base;
@tailwind components;
@tailwind utilities;
.field {
@apply .rounded .border .py-2 .px-3 .text-gray-800;
}
.field-label {
@apply .mb-2 .uppercase .font-bold .text-lg .text-gray-900;
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
@skadimoolam
skadimoolam / newConfig.php
Created June 20, 2020 14:47
A simple way to write new Laravel config file dynamically | More info at https://simplestweb.in
<?php
$rawSettings = json_decode($request->get('settings'), true);
if ($rawSettings == null) abort(500);
config(['settings' => $rawSettings]);
$text = '<?php return ' . var_export(config('settings'), true) . ';';
file_put_contents(config_path('settings.php'), $text);
<?php
if (! function_exists('say_hi')) {
function say_hi($name) {
return 'Hi ' . $name;
}
}
# Add the domain name of your choice
SITE_URL=myapp.com
@skadimoolam
skadimoolam / profiles.json
Last active March 24, 2020 07:39
Windows Terminal Configuration
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"requestedTheme" : "system",
"launchMode":"maximized",
"profiles":
{
"defaults": {
@skadimoolam
skadimoolam / checkbox.blade.php
Last active February 8, 2020 17:03
Customizable form partials for Laravel - https://laravelcollections.com
@php
$d = $d ?? null; // default value
@endphp
<div class="form-group row">
<label for="{{ $n }}" class="col-sm-4 col-form-label text-md-right"><b>{{ $l }}</b></label>
<div class="col-md-8">
<input id="{{ $n }}" type="checkbox" class="form-control" name="{{ $n }}" value="1" @if(old($n, $d) == '1') checked @endif>
@if ($errors->has($n))
<small class="text-danger">{{ $errors->first($n) }}</small>
@skadimoolam
skadimoolam / UsersController.php
Last active October 30, 2019 10:42
Reusing a Controller method for multiple actions in Laravel - SimplestWeb (https://simplestweb.in/blog/reusing-a-controller-method-for-multiple-actions-in-laravel)
class UsersController
{
// ......
public function index(Request $request) {
$edit = null;
// We check if the edit parameter is set, if so we find the user with that ID
// This $edit variable can be used in our template
if ($request->has('edit')) $edit = User::where('id', $request->query('edit'))->first();