Skip to content

Instantly share code, notes, and snippets.

View Luizgpp's full-sized avatar
🎯
Focusing

Luiz Gabriel Parreira Pereira Luizgpp

🎯
Focusing
  • DDMX - Produtividade Inteligente
  • Itajuba
View GitHub Profile
@Luizgpp
Luizgpp / laravel.js
Created September 1, 2016 05:12 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Session;
@Luizgpp
Luizgpp / bugajax.js
Last active September 20, 2016 23:16
// create post
$('form#form-post').on("submit", function(e){
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Carrinho = {
add: function addCarrinho(url) {
$.ajax({
type: "GET",
url: url,
data: "",
success: function() {
$('.cart-total').load(document.URL + " .cart-total ul");
}
});
@Luizgpp
Luizgpp / Friendship.php
Created January 28, 2019 21:52 — forked from sayhicoelho/Friendship.php
Laravel: A Trait for friendship.
<?php
namespace App\Traits;
use App\User;
trait Friendship
{
public function solicitationsOfMine()
{
@Luizgpp
Luizgpp / _spacing-helpers.scss
Created January 31, 2019 16:48 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@Luizgpp
Luizgpp / gist:3c54cf638587ba85c92184b067a6a76f
Created April 19, 2019 00:17 — forked from voskobovich/gist:537b2000108e4781f70b
List of most currency ISO code and symbol format in SQL.
DROP TABLE currency;
-- Create table variable
CREATE TABLE currency (
name VARCHAR(100),
code VARCHAR(100),
symbol VARCHAR(100)
);
-- Insert currency records
<?php
class Colaborador extends Model
{
protected $table = "colaboradores";
public function user()
{
return $this->belongsTo(User::class);
}
<?php
class Cargo extends Model
{
protected $table = "cargos";
public function colaborador()
{
return $this->hasMany(Colaborador::class);
}
}
<?php
class User extends Authenticatable
{
use Notifiable;
public function colaborador()
{
return $this->hasOne(Colaborador::class);
}