REQUEST
Craft::$app->getRequest()
Craft::$app->getRequest()->getAcceptsJson()
$this->asJson();
CURRENT USER
Craft::$app->getUser()->getIdentity()
<?php | |
/** | |
* Database Configuration | |
* | |
* All of your system's database configuration settings go in here. | |
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php | |
*/ | |
return array( |
<?php | |
// Variables used in this script: | |
// $summary - text title of the event | |
// $datestart - the starting date (in seconds since unix epoch) | |
// $dateend - the ending date (in seconds since unix epoch) | |
// $address - the event's address | |
// $uri - the URL of the event (add http://) | |
// $description - text description of the event | |
// $filename - the name of this file for saving (e.g. my-event-name.ics) | |
// |
(function (m) { | |
/* | |
* PHP => moment.js | |
* Will take a php date format and convert it into a JS format for moment | |
* http://www.php.net/manual/en/function.date.php | |
* http://momentjs.com/docs/#/displaying/format/ | |
*/ | |
var formatMap = { | |
d: 'DD', | |
D: 'ddd', |
REQUEST
Craft::$app->getRequest()
Craft::$app->getRequest()->getAcceptsJson()
$this->asJson();
CURRENT USER
Craft::$app->getUser()->getIdentity()
// Implementation in ES6 | |
function pagination(c, m) { | |
var current = c, | |
last = m, | |
delta = 2, | |
left = current - delta, | |
right = current + delta + 1, | |
range = [], | |
rangeWithDots = [], | |
l; |
<template> | |
<div> | |
<input v-model="emailAddress" type="email" placeholder="[email protected]" /> | |
<button @click="submitForm">{{subscribeText}}</button> | |
</div> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { |
<?php | |
use yii\base\Event; | |
use Craft; | |
use craft\elements\Entry; | |
Event::on( | |
Entry::class, | |
Entry::EVENT_AFTER_SAVE, | |
function(ModelEvent $event) { |
#DB Backup Restore *LOCAL ONLY* | |
#You can access other DB variables to add to the command. EX: {server}, {user}, {port}… | |
LOCAL_DB_BIN="/Users/Shared/DBngin/mysql/8.0.27/bin/" | |
BACKUP_COMMAND="${LOCAL_DB_BIN}mysqldump -h {server} -u {user} --port {port} --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file=\"{file}\" {database} && ${LOCAL_DB_BIN}mysqldump -h {server} -u {user} --port {port} --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table={database}.assetindexdata --ignore-table={database}.assettransformindex --ignore-table={database}.cache --ignore-table={database}.sessions --ignore-table={database}.templatecaches --ignore-table={database}.templatecachecriteria --ignore-table={database}.templatecacheelements --ignore-table={database}.templatecachequeries {database} >> \"{file}\"" | |
RESET_COMMAND="${LOCAL_DB_BIN}mysql -h {s |
<?php | |
namespace modules; | |
use Craft; | |
use yii\base\Event; | |
use craft\events\DefineGqlTypeFieldsEvent; | |
use craft\gql\TypeManager; | |
use GraphQL\Type\Definition\Type; | |
use modules\types\VideoGqlType; |