Skip to content

Instantly share code, notes, and snippets.

View naneri's full-sized avatar
👔

Kana naneri

👔
View GitHub Profile
@Rhincodon
Rhincodon / eloquent-tricks.md
Last active January 10, 2016 02:20
Трюки Eloquent для лучших репозиториев

Источник

Трюки Eloquent для лучших репозиториев

Одна из лучших вещей в написании кода - очевидность хороших практик, ведь если им не следовать, возникает раздражение. Очень надоедает, когда вам нужно писать одну и ту же вещь снова и снова. Когда вы чувствуете себя недовольным из-за повторения одних и тех же вещей, наступает время абстракции.

В типичном приложении вы, вероятно, имеете множество Репозиториев для работы с вашей системой хранения. Когда вы используете Laravel, вы проводите много времени работая с Eloquent. Тем не менее, поверьте мне, когда у вас есть множество Репозиториев, вам быстро надоедает многократно писать одни и те же методы для доступа к данным.

В этом руководстве я хочу рассмотреть некоторые паттерны для абстракции основных методов, которые вы больше не будете повторять в каждой реализации ваших Репозиториев. Я также покажу, как мы можем использовать гибкость Eloquent и его Query Builder для написания действител

@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active March 31, 2024 11:57
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@naneri
naneri / Dump the $variable
Last active August 29, 2015 14:02
Dumps the $variable and displays it nicely. After that finishes the script. This Gist can be set as a code snippet in Netbeans / Notepad++ / Any other editor, so that it can be used to quickly find out, what is inside the variable.
echo "<pre>"; print_r($variable); echo "</pre>";
exit;
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@JeffreyWay
JeffreyWay / laravel.js
Last active April 6, 2024 20:12
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {