Skip to content

Instantly share code, notes, and snippets.

@scoumbourdis
scoumbourdis / CustomersModel.php
Last active March 15, 2023 18:07
A full example of custom model for Grocery CRUD Enterprise
<?php
//CustomersModel.php
use GroceryCrud\Core\Model;
use GroceryCrud\Core\Model\ModelFieldType;
class CustomersModel extends Model {
protected $ci;
protected $db;
# Tweet Message "To send this tweet* I’ve used only Github Copilot suggestions with a programming language I am not familiar with 😮\n\n*through twitter API"
twitterMessage = "To send this tweet* I’ve used only Github Copilot suggestions with a programming language I am not familiar with 😮\n\n*through twitter API"
# post tweet to twitter
import tweepy
import os
# send tweet
def send_tweet(message):
# Twitter API credentials
---
src/GroceryCrud/Core/State/StateAbstract.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/GroceryCrud/Core/State/StateAbstract.php b/src/GroceryCrud/Core/State/StateAbstract.php
index 6b37f87..c2c2424 100644
--- a/src/GroceryCrud/Core/State/StateAbstract.php
+++ b/src/GroceryCrud/Core/State/StateAbstract.php
@@ -1311,11 +1311,14 @@ class StateAbstract
public function getFieldTypesAddForm() {
-- Please have in mind that as those data are only for testing purposes
-- we did add the full list of cities only for Greece and United Kingdom.
-- Other than that they are few cities for France and Italy in case you would
-- like to test it.
--
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
@scoumbourdis
scoumbourdis / grocerycrud.php
Last active September 5, 2020 06:12
Laravel configuration file for Grocery CRUD Enterprise
<?php
// config/grocerycrud.php
return [
// So far 34 languages including: Afrikaans, Arabic, Bengali, Bulgarian, Catalan, Chinese, Czech, Danish,
// Dutch, English, French, German, Greek, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean,
// Lithuanian, Mongolian, Norwegian, Persian, Polish, Portuguese, Brazilian Portuguese, Romanian,
// Russian, Slovak, Spanish, Thai, Turkish, Ukrainian, Vietnamese
'default_language' => 'English',
@scoumbourdis
scoumbourdis / GroceryCrudEnterprise.php
Last active September 5, 2020 06:11
This is the default configuration for Grocery CRUD Enterprise and Codeigniter 4
<?php namespace Config;
use CodeIgniter\Config\BaseConfig;
class GroceryCrudEnterprise extends BaseConfig
{
public function getDefaultConfig() {
helper('url');
return [
@scoumbourdis
scoumbourdis / ExportState.php
Last active July 25, 2020 07:10
A PHP library for replacing the default Export State of Grocery CRUD Enterprise
<?php
namespace MyCustomStates;
use GroceryCrud\Core\GroceryCrud as GCrud;
use GroceryCrud\Core\State\StateInterface;
use GroceryCrud\Core\State\ExportState as GcExportState;
class ExportState implements StateInterface {
@scoumbourdis
scoumbourdis / messy-code.php
Created June 15, 2020 10:39
This is an example of a messy code. Please do not copy any of this code as this is just an example of a bad code
<?php
// This is an example of a messy code. Please do not copy any of this code as this is just an example of a bad code.
if (!empty($_GET['id'])) {
$id = $_GET['id'];
if (!is_numeric($id)) {
header("HTTP/1.0 404 Not Found");
echo "<h1>⚠️ We are sorry, page not found</h1>";
die;
}
} else {
@scoumbourdis
scoumbourdis / Example.php
Last active June 4, 2020 03:39
Example Controller for Grocery CRUD Enterprise and Codeigniter 4
<?php
namespace App\Controllers;
include(APPPATH . 'Libraries/GroceryCrudEnterprise/autoload.php');
use GroceryCrud\Core\GroceryCrud;
class Example extends BaseController
{
public function index()
{
@scoumbourdis
scoumbourdis / example.php
Last active June 3, 2020 04:19
Grocery CRUD Enterprise app/Views/example.php for Codeigniter 4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<?php
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>