Skip to content

Instantly share code, notes, and snippets.

View brandongallardoa's full-sized avatar

Brandon Gallardo brandongallardoa

View GitHub Profile
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateProfilePicture extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
// requests
use App\Http\Requests\UpdateProfilePicture;
// models
Route::post('update_profile_picture', 'ProfileController@updateProfilePicture')->name('profile.update.picture');
<form action="{{ route('profile.update.picture') }}">
<div style="overflow-x: hidden;border: 1px solid #f1f1f1; margin: 5px 0px 3px 0px;">
<input type="file" name="profile-picture" class="btn btn-xs">
</div>
<button type="submit" class="btn btn-primary btn-xs">Actualizar</button>
</form>
<?php
use Illuminate\Database\Seeder;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
<?php
...
class User extends Authenticatable
{
...
/**
* Helper methods
*/
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<?php
....
class CreateLikesTable extends Migration
{
public function up()
{
Schema::create('likes', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
<?php
...
class CreateCommentsTable extends Migration
{
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('user_id')->references('id')->on('posts')->onUpdate('cascade')->onDelete('cascade');
<?php
...
class CreatePostsTable extends Migration
{
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();