anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
function tick(e) {
node
.each(gravity(e.alpha * .1))
.each(collide(.5))
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
label
.style("left", function(d) { return (d.x - d.dx / 2) + "px"; })
.style("top", function(d) { return (d.y - d.dy / 2) + "px"; }... | Simulate forces and update node and label positions on tick. |
function createNewReplyBox(reply_location){
div_top = reply_location.parentElement.parentElement.childNodes[3];
debugger;
div1 = document.createElement("div");
div1.className = "replies";
div1.style.display = "block";
div_top.parentNode.insertBefore(div1, div_top.nextSibling);
blank1 = document.createTex... | create new reply box |
function convertToFahrenheit(temp){
let fahr = temp *9/5 +32;
console.log(`${temp} degrees in C is ${fahr} degrees in F`);
} | Fahrenheit = Celcius 9/5 +32 |
function copy() {
// Copy these folders and contents as is
gulp.src([
'src/background/**',
'src/content/**',
'src/popup/**',
'src/styles/**',
'src/vendor/**'], {base: 'src'})
.pipe(gulp.dest(OUTPUT_DIR_WEB_EXTENSION));
// Compile less into css
gulp.src('src/**/*.less', {base: 'src'})
... | Define our tasks using plain functions |
function setEventBehaviour(){
button.style("pointer-events","all");
} | sets event behaviour button needs always be clickable even if nonClickable layer blocks it |
function SpriteCollision(offset, sprite1, sprite2)
{
for (var x = 0; x < sprite1.width; ++x)
{
var xx = +x + +offset[0];
if (xx < 0 || xx >= sprite2.width) continue;
for (var y = 0; y < sprite1.height; ++y)
{
var yy = +y + +offset[1];
if (yy < 0 || yy >= sprite2.height) continue;
var pix1 = sprite1.r... | Sprite based collision checking |
function datosugerencia($id_sugerencia){
var id = $id_sugerencia;
var base_url= 'http://localhost/sistema_monedas/';
$.ajax({
url: base_url + "sugerencias/view/" + id,
type:"POST",
success:function(resp){
$("#modal-default .modal-body").html(resp);
... | MERCADO SECCION MONEDAS SUGERENCIAS |
function handleTransparentNavbar() {
setTransparentNavbar(dispatch, (fixedNavbar && window.scrollY === 0) || !fixedNavbar);
} | A function that sets the transparent state of the navbar. |
function removeComment() {
let shortenId2=this.id.slice(15)
// console.log(shortenId2)
let commentRef3= firebase.database().ref("posts/"+shortenId2);
let optionConfirmRemove = confirm ("Confirma si quieres eliminar el comentario")
if (optionConfirmRemove == true){
commentRef3.remove();
}... | Funcion para eliminar comentarios |
function buttonsSetting() {
var buttons = document.getElementsByTagName("li");
for (var i = 0; i < buttons.length; i++) {
buttons[i].bubbles = true;
EventUtil.addHandler(buttons[i], "click", buttonFunc(i, "custom"));
}
} | initialize all the button click function |
getProcessedValue(value) {
const {
minDate, maxDate, maxDetail, returnValue,
} = this.props;
const processFunction = (() => {
switch (returnValue) {
case 'start':
return getDetailValueFrom;
case 'end':
return getDetailValueTo;
case 'range':
... | Gets current value in a desired format. |
function ScenarioStepFactory(step,ctx) {
this.isAction = () => step.action !== undefined
this.isConsumedMessage = () => (step.message !== undefined) && (step.consumed_by !== undefined)
this.isProducedMessage = () => (step.message !== undefined) && (step.produced_by !== undefined)
this.isCalledAPI = () => (step.... | If you have a new step, just add a condition and create the class |
function getLineContent(cm, lineView) {
var ext = cm.display.externalMeasured;
if (ext && ext.line == lineView.line) {
cm.display.externalMeasured = null;
lineView.measure = ext.measure;
return ext.built
}
return buildLineContent(cm, lineView)
} | Wrapper around buildLineContent which will reuse the structure in display.externalMeasured when possible. |
function leaveClient() {
socket.emit('leave', {name: playerId});
} | Client wants to leave the game |
function makeInterval() {
intervalID = setInterval(function() {
fadeOutAndIn();
}, intervalTime);
} | Function to set the interval execution |
function resolveCircularModuleDependency$1(fn) {
{
if (!isFunction$2(fn)) {
throw new TypeError(`Circular module dependency must be a function.`);
}
}
return fn();
} | When LWC is used in the context of an Aura application, the compiler produces AMD modules, that doesn't resolve properly circular dependencies between modules. In order to circumvent this issue, the module loader returns a factory with a symbol attached to it. This method returns the resolved value if it received a fac... |
function _subfunction(placeObject){
console.log('displayed'+placeObject.name);
var retval=new VenueObject(placeObject);//turn that off
retval.done(function(marker){
placeObject.marker=marker;
});
} | the above contains processing for the entry the following displays it, but should be extracted possibly to the updateVenueMarkerVisibilityFlag... this attempts to display all |
function getTemperature(){
$.getJSON("api/getTemp", function(tempJson){
updateGraph(tempJson);
});
} | Get the temp from the the API with a getJSON call |
async function getArtists() {
//In questa copia del progetto, mi sono salvato tutti gli artisti e le loro informazioni in un file json
artistsList = await fetch('artists.json').then(r => r.json());
} | Data fetch: artists' info |
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = __webpack_require__(4695);
createDebug.destroy = destroy;
Object.keys... | This is the common logic for both the Node.js and web browser implementations of `debug()`. |
function addInventory() {
var query = "SELECT * from products";
connection.query(query, function (error, results) {
if (error) throw error;
inquirer.prompt([
{
type: "input",
message: "What is the id of the product you want to add?",
... | Function to add to inventory |
restart() {
this.x = 200;
this.y = 380;
} | Set player to intial location. |
function applyTransforms(el, nobodyscale) {
// zoomer area and scale value
var zoomerArea = el.querySelector('.zoomer__area'),
zoomerAreaSize = {width: zoomerArea.offsetWidth, height: zoomerArea.offsetHeight},
zoomerOffset = zoomerArea.getBoundingClientRect(),
scaleVal = zoomerAreaSize.width/zoomerAreaSize... | applies the necessary transform value to scale the item up |
function bodyBG(image) {
let bg = "linear-gradient(45deg,rgba(0, 0, 0, 0.6) 65%, rgba(250, 250, 250, 0.34))";
if (window.innerWidth < 800) {
document.body.style.backgroundImage = bg + ",url('img/sm/" + image + "')";
} else {
document.body.style.backgroundImage = bg + ",url('img/" + image + ... | Change the BG of body |
function HandlerStackEntry(k, next)
{
this.k = k;
this.next = next;
} | Constructor for a stack entry on the global exception handler stack |
render() {
return (
<div>
{this.props.children(this.state.count, this.incrementCount)}
</div>
);
} | render the children of this component the children of this component is an arrow function that takes the count and inrementCount and renders the original component and passes the count and inrementCount to it |
getId(title, year) {
//using the google youtube api to get the video id
let youtube = (params, callback) => {
axios.get(this.state.url, { params: params }).then(function(response) {
callback(response.data.items[0])
}).catch(function(error) {
console.error(error);
});
... | method to get the movieID and setting it to state |
function updateProfile() {
if (newName.value!="") {
name.innerHTML = newName.value;
}
if (newEmail.value!="") {
email.innerHTML = newEmail.value;
}
if (newPhone.value!="") {
phone.innerHTML = newPhone.value;
}
if (newZipcode.value!="") {
zipcode.innerHTML = newZipcode.value;
}
if (newPassw... | update the profile and clear the input text |
function createControls(camera, domElement) {
// Create new OrbitControls linked to the camera and the renderer's DOM element
const controls = new OrbitControls(camera, domElement);
return controls;
} | Function to initialize the controls |
async createTypePlant(req, res) {
const { name, legendary } = req.body;
const newType = new TypePlant({ name, legendary });
try {
await newType.save(function (err) {
if (err) return res.status(400).json({ error: `Error en los datos ingresados` });
res.status(200).json({ message: `Planta ${name} creada ... | ================================ POSTS =============================== create new user |
function subscribe(name, callback) {
// Subscripton names are lowercased so both 'Shift+Space' and 'shift+space' works.
name = name.toLowerCase();
// remove spaces so both 'Shift + Space' and 'shift+space' works.
name.replace(/\s/, '');
if (typeof __subscriptions[name] === 'undefined') {
__su... | creates a subscription and returns the unsubscribe function; |
function particle() {
for (var i=0; i<50; i++) {
var dir = new THREE.Vector3(2*Math.random()-1, Math.random()*4, 2*Math.random()-1);
dir.multiplyScalar(6/dir.length());
var color = (Math.random() > 0.5) ? 0x333333 : 0x666666;
var p = new Particle(obj.position, dir, color, 0.1);
... | var j = 0; |
function propertyValue(t, v) {
if (t === 'string')
return util.inspect(v, { colors: true });
else if (t === 'number' || t === 'boolean')
return v.toString().blue;
else if (t === 'object' && v == 'null')
return 'null'.blue;
else if (t === 'undefined')
return 'undef... | TODO: check if result is React component and highlight it |
get not() {
return {
/**
* Returns true if PageElement currently does not exist.
*/
exists: () => !this.exists(),
/**
* Returns true if PageElement is currently not visible.
*/
isVisible: () => !this.isVisible(),... | returns the negated variants of PageElementCurrently's state check functions |
onAddComment(evt){
evt.preventDefault();
if (this.state.comment.trim() === ''){
return;
}
const newComment = {
content: this.state.comment,
posted: new Date(),
}
// empty the comment text
this.setState({comment: ''});
... | Adds the comment to local storage via redux actions |
function makeCompare (fn) {
return function (value, key) {
return hasOwn(this, key) && fn(value, this[key])
}
} | makes a function to compare the object values from the specified compare operation callback |
function resetTodosList (jsonObject) {
//empty tasks
jsonObject.tasks = [];
console.log('tasks list emptied successfully');
//turn into string and save it to the file
jsonObject = JSON.stringify(jsonObject);
return fs.writeFile('todo.json',jsonObject);
} | resets the amount of tasks to 0 takes the todosFile json and modifies the tasks in it this function is invoked when the user enter the command 'reset' |
function drawRoundCorner(Wright, r, transform$$1) {
var angle = Math.PI/2 * Wright / (Wright + Wtop);
// not sanitizing this one, because negative values
// are useful to fill the box correctly.
var ri = {
x: r.x - Wright,
y: r.y - Wtop
... | draws one round corner, starting at origin (needs to be translated/rotated to be placed properly). |
function updateQuiz(pointer, value, currentlyEditing) {
setQuiz(oldQuiz => {
let q = [...oldQuiz.problems];
q = q.map((problem, i) => {
if (i === pointer) {
if (currentlyEditing.type === QUESTION) {
return { ...problem, question: value };
} else if (currentlyEditi... | Helper functions for state... |
function cargarMT(){
if( APIcompatible() ) { //[1]
$('#cargarMT').trigger('click'); //[2]
}else{
mostrarAlert('API FileRader no compatible con este navegador.')
}
} | Carga la MT / 1. Comprueba si el API es compatible con el navegador 2. Hacemos trigger en el input que carga la ventana del explorador de archivos |
function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setState, forceUpdate, etc.... | Mark a component as needing a rerender, adding an optional callback to a list of functions which will be executed once the rerender occurs. |
function retrieveFooterIcon(iconNum) {
iconNum = iconNum ? iconNum : 0
switch(iconNum) {
// Devices Cards
case '1':
return <FontAwesomeIcon icon={faMapMarkerAlt} style={{width: '20px', height: '20px'}} />;
// Warehouses Cards
case '2':
return <FontAwesomeIcon icon={faWare... | Retrieving an icon for the card's footer: |
function squareTest(t){ //t=1 for player1, t=2 for player2
j=1;
while (gotSquare==0 && j<n+1){
i=1;
while (gotSquare==0 && i<n+1){
if (state[i][j]==t){
for (l=j;l<n+1;l++){
if (l==j){start=i+1}else{start=1;}
for (k=start;k<n+1;k++){
if (state[k][l]==t){
if ((0<k+l-j && k+l-j<n+1 &&... | test for square code |
function formatQueryParams(params) {
const queryItems = Object.keys(params).map(
(key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`
);
return queryItems.join("&");
} | combines searchURL with user input |
function changeEmojiWeek(){
var em = document.getElementById("weekList").childElementCount;
if(em == 0){
document.getElementById("emojiWeek").innerHTML = "😀";
}else if(em < 3){
document.getElementById("emojiWeek").innerHTML = "🙄";
}else if(em < 5){
document.getElementById("emojiWeek").innerHTML... | This does the same as the function above, but for the weekList table. |
function getIt(id) {
var result;
result = document.getElementById(id).value.trim();
return result;
} | Get the value for the table cell |
setCurrentRouteName(routeName){
currentRoute = routeName;
currentPoiIndex = null;
} | set xurrent route name |
function toggleDetails() {
const details = d3.select("#details");
details.style("display",
details.style("display") === "none" ? "block" : "none"
);
d3.select("#guide strong").text(
details.style("display") === "none" ? "show" : "hide"
);
} | Show or hide the ondemand details panel. |
function mergeHook (
parentVal,
childVal
) {
var res = childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal;
return res
? dedupeHooks(res)
: res
} | Hooks and props are merged as arrays. |
function createOptions( options ) {
var object = {};
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
} | Convert Stringformatted options into Objectformatted ones |
createMultiplayerIO() {
this.socket.on("pong", (pingTimestamp) => {
var pongTimestamp = Date.now();
var ping = pongTimestamp - pingTimestamp;
this.events.emit('ping', ping);
});
this.otherPlayers = this.physics.add.group();
this.socket.on('currentPlayers', function (data) {
this.createAllPlayers(... | Partial class which not works on its own |
function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
var state = draggable.state;
var isStart = !(0, _shims.isNum)(state.lastX);
var node = findDOMNode(draggable);
if (isStart) {
// If this is our first move, use the x and y as last coords.
return... | Create an data object exposed by 's events |
setOption(internal_name, option) {
if (IsString(internal_name, true) && IsObject(option)) {
PopLog.info(this.name, `Option set for ${internal_name}`, option);
this.asset.option.set(internal_name, option);
}
} | Attach a set of options to widget |
function getExternalId(story) {
$.ajax({
url: pivotalProjectUrl + "/stories/" + story.getAttribute('data-id'),
async: false,
dataType: 'json',
success: function(data) {
id = data.external_id;
if(id !== null) {
jiraUrl = jiraBase + id;
... | Grabs the external_id from the Pivotal API |
isWorseThan(other) {
return !this.isBetterThan(other);
} | So we can use nice names |
makeBody(){
// an object for mail
let mail;
mail = new mailComposer({
to: this.to,
text: this.body,
subject: this.sub,
textEncoding: "base64"
});
//Compiles and encodes the mail.
mail.compile().build((err, msg) => {
if (err){
return console.log('Error compiling email ' + error);
}
... | Creates the mail body and encodes it to base64 format. |
static findOneWhereOrder(from, select, where, orderBy, callback) {
findOne(from, where, select, orderBy, callback);
} | FROM, SELECT, WHERE, ORDERBY, CALLBACK |
function fetchImage2base64 (path, dest, key) {
return limitedFetch(`${domain}${path}`)
.then(r=>r.buffer())
.then(buf=>{
const imgdom = new JSDOM(buf);
const src = imgdom.window.document.querySelector('img').getAttribute('src');
const imageBuffer = decodeBase64Ima... | Fetch an image (html img snippet with inline base64 src attribute) snippet and save the image as file |
displayPath()
{
// Show start and end waypoints.
let startMarker = new google.maps.Marker({
position: this._navPath.waypoints[0],
map: this._map,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 5,
fillCo... | Display path on map, along with markers for start and end waypoints, and for the next waypoint. |
constructor() {
super();
} | Instance of the element is created/upgraded. Use: initializing state, set up event listeners, create shadow dom. |
function average(numbers) {
let sum = 0;
numbers.forEach(function(arrNum) {
sum = arrNum += sum;
});
let arrAvg = sum/numbers.length;
return arrAvg;
} | Compute the average with .forEach() |
function toTitleCase(str)
{
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
} | helper function to make title case |
function RSAEncrypt(text) {
var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3);
if(m == null) return null;
var c = this.doPublic(m);
if(c == null) return null;
var h = c.toString(16);
if((h.length & 1) == 0) return h; else return "0" + h;
} | Return the PKCS1 RSA encryption of "text" as an evenlength hex string |
function deleteCourse() {
let courseId = $(this).attr('data-id');
coursesService.deleteCourse(courseId)
.then(() => {
showInfo('Course deleted.');
loadMyCourses();
// showView('Catalog');
}).catch(handleError);
} | LOGIC TO DELETE COURSE |
fillForm(fSalut) {
this.salutationForm.setValue({
firstname: fSalut.firstname,
gender: fSalut.gender,
// language: fSalut.language,
language: this.convertLanguage(fSalut.language),
lastname: fSalut.lastname,
letterSalutation: fSalut.letterS... | Fill the formatted Salutation in the Form |
isEmpty() {
return this.heap.length === 0;
} | check if the heap is empty |
function fizzBuzz(fizz, buzz) {
// initialize an array to hold our results
let resultsArray = [];
// use a for loop to replace words divisable by 3, 5, or both with fizz, buzz, or fizzbuzz respectively
// use the continue statement to exit the current iteration of the for loop and continue to the next
... | logic function calculate which numbers to replace with fizz/buzz |
function astFromValue(value, type) {
// Ensure flow knows that we treat function params as const.
var _value = value;
if (type instanceof _definition.GraphQLNonNull) {
var astValue = astFromValue(_value, type.ofType);
if (astValue && astValue.kind === Kind.NULL) {
return null;
}
return astV... | Produces a GraphQL Value AST given a JavaScript value. A GraphQL type must be provided, which will be used to interpret different JavaScript values. | JSON Value | GraphQL Value | | | | | Object | Input Object | | Array | List | | Boolean | Boolean | | String | String / Enum Value | | Number | Int / Float | | Mixed | E... |
function generatePathLinkout(pathArray) {
// Build an html string of the paths
// pathArray is a list of dicts for each edge in the path:
// pathArray[i] gives a dict for the support of edge i
// pathArray[i][stmt type j] is a list of all statements of type j supporting edge i
// pathArray[i][stmt type j][k] ... | Function to put stmts from path in a HTML format with linkouts |
gotoCheckLimit(current_line, n_item, line_limit) {
if (n_item > 0 && current_line < line_limit) {
return true;
}
else if (n_item < 0 && current_line > line_limit) {
return true;
}
else {
return false;
}
} | gotoCheckLimit is configured only for [n_item = +1 or 1] it may be extended later |
initViews() {
let viewsId = []; //array used for interface cameras dropdown
for (var key in this.graph.views) {
if (this.graph.views.hasOwnProperty(key)) {
var view = this.graph.views[key];
if (view.type === "ortho") {
let v = new CGFcame... | Initializes the scene views with the values read from the XML file. |
function handleClickOutside(event) {
if (ref.current && !ref.current.contains(event.target) && menuButtonRef.current && !menuButtonRef.current.contains(event.target) && props.isColumnNavBarDisplayed) {
// If outside, then close the ul list
props.requireColumnNavBarDisplayedToggle();
... | Alert if clicked on outside of ul list and menu button |
function formatMoment(m, format) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format = expandFormat(format, m.localeData());
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
return formatFunctions[format](m);
} | format date using native date object |
greet() {
console.log('hello' + ' ' + this.firstname + ' ' + this.lastname);
} | public function avialble for evryone just like function prototype |
function fieldPathFromArgument(methodName, path) {
if (path instanceof FieldPath$1) {
return path._internalPath;
}
else if (typeof path === 'string') {
return fieldPathFromDotSeparatedString(methodName, path);
}
else {
var message = 'Field path arguments must be of ty... | Helper that calls fromDotSeparatedString() but wraps any error thrown. |
function interpolate(from, to, direction, stream) {
circleStream(stream, radius, delta, direction, from, to);
} | TODO optimise for this common case |
function getRegularCustomerAccountsAndValue(jsonFeed){
var regValues = new Array(4);
regValues[0] = jsonFeed[3];
regValues[1] = jsonFeed[4];
regValues[2] = jsonFeed[1];
regValues[3] = jsonFeed[1];
return regValues;
} | replace this once we get the database in place |
Remove the specified resource from storage. | public function destroy(keterlambatan $keterlambatan)
{
//
} |
Generates a new configuration name based on the provided parameters | protected function generateConfigurationName(array $vclList = null, $prefix = 'load') {
if (!$vclList) {
$vclList = $this->getVclList();
}
$index = 1;
foreach ($vclList as $name => $status) {
if (strpos($name, $prefix) !== 0) {
continue;
... |
Sets the Icontact Prospect Last Name attribute value. | public function setLastName(string $last_name = null) : CNabuDataObject
{
$this->setValue('nb_icontact_prospect_last_name', $last_name);
return $this;
} |
Update the specified resource in storage. | public function update(Request $request, Category $category)
{
$path = $category->title_image;
if($request->file('image')) {
if(Storage::exists($category->title_image && $category->title_image !== "public/1.jpg")) {
Storage::delete($category->title_image);
}
... |
The agency the account belongs to. Technically the owner should also be part of the agency. | public function agency(): BelongsTo
{
return $this->belongsTo(Agency::class);
} |
Set the max Chars that can be in each line | public function setMaxLineLength(?int $maxLineLength): void {
$this->maxLineLength = $maxLineLength;
} |
Constructs the forum settings. | public function __construct($forumManager) {
$this -> forumManager = $forumManager;
$this -> db = $forumManager -> getDatabase();
} |
Show the form for creating a new resource. | public function create()
{
if(Auth::check()){
$user_id = auth::user()->id;
if($user_id==2){
return redirect('/delivery/payment');
}
}
$category = Category::all();
$subcategory = SubCategory::all();
return view('admin_ui.... |
This is the unique name corresponding to the Pay Connector installed in the Twilio Addons. Learn more about [ Connectors]( The default value is `Default`. | public function setPaymentConnector(string $paymentConnector): self
{
$this->options['paymentConnector'] = $paymentConnector;
return $this;
} |
Indicates whether this content is family friendly. | public function setIsFamilyFriendly($isFamilyFriendly) {
$this->properties['isFamilyFriendly'] = $isFamilyFriendly;
return $this;
} |
quitar caracteres especiales para evitar sqlinjection | function decode($string){
$nopermitidos = array("'",'\\','<','>',"\"","%");
$string = str_replace(" ","",$string);
$string = str_replace($nopermitidos, "", $string);
return $string;
} |
Extension Functions ========================================================= Activate Extension | public function activate_extension()
{
// Check for Freeform install
if ( ! $this->EE->db->table_exists('freeform_fields'))
{
return FALSE;
}
$hooks = array(
'freeform_module_insert_begin' => 'insert_new_entry'
);
foreach ($hooks as $hook => $method)
{
$this->EE->db->insert(
'exp_exte... |
Create tables in db | public static function up(){
DBW::create('Comment',function($t){
$t -> varchar('name')
-> text('message')
-> tinyint('public_flag')
-> datetime('timestamp');
});
} |
Store a newly created resource in storage. | public function store(KitchenRecipeCreateRequest $request)
{
$data = $request->input();
$data['user_id'] = Auth::user()->id;
$recipe = (new KitchenRecipe())->create($data);
if($recipe){
return redirect()->route('kitchen.admin.recipes.edit', [$recipe->id])
... |
Validate and update the given user's profile information. | public function update($user, array $input)
{
Validator::make($input, [
'phone' => ['required', 'numeric', 'digits_between:1,15'],
'address' => ['required', 'string'],
'city' => ['required', 'string'],
'country' => ['required', 'string'],
])->validate(... |
Removes singleuse query args derived from executed actions in the admin. | function affwp_remove_query_args( $query_args ) {
// Prevent certain repeated AffWP actions on refresh.
if ( isset( $_GET['_wpnonce'] )
&& (
isset( $_GET['affiliate_id'] )
|| isset( $_GET['creative_id'] )
|| isset( $_GET['referral_id'] )
|| isset( $_GET['visit_id'] )
)
) {
$query_args[] = '_wpn... |
Show the form for editing the specified resource. | public function edit(Employee $employee)
{
//
} |
Gave up on the Eloquent relational model | public function getLeadVolunteers($ProjectID) {
return $project_leads = Volunteer::join('project_volunteer_role', 'volunteers.VolunteerID', '=', 'project_volunteer_role.VolunteerID')
->join('project_roles', 'project_volunteer_role.ProjectRoleID', '=', 'project_roles.ProjectRoleID')
... |
Returns information for photo by given id. | abstract public function getById($id); |
Return current logged in user | public static function current(): ?User
{
if ($userId = get_current_user_id()) {
return new static($userId);
}
return null;
} |
Display the specified resource. | public function show($id)
{
//
} |
Get the plan price status | public function hasPrice()
{
return $this->amount_month || $this->amount_year;
} |
Find object by primary key. | protected function findPkComplex($key, ConnectionInterface $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.