Skip to content

Instantly share code, notes, and snippets.

View raymond1988's full-sized avatar

Raymond raymond1988

View GitHub Profile
/*Small devices (landscape phones, 576px and up)*/
@media (min-width: 576px) {
/*card colums setup 2 columns for mobile on landscape view*/
.card-columns{
column-count: 2;
public function update(UpdateBlogPostRequest $request, Post $post) {
//update post
DB::table('posts')
->where('id', $post->id)
->update([
'title' => $request->input('title'),
'description' => $request->input('description'),
'content' => $request->input('content')]
);
public function store(StoreBlogPostRequest $request) {//type hint the store function
//check if the user it authenticated
if (Auth::check()) {
//create a new post
$post = new Post;
//save the post
$post->title = title_case($request->title);
$post->description = $request->description;
$post->content = $request->content;
@raymond1988
raymond1988 / UpdateBlogPostRequest
Created May 4, 2018 16:14
This code is for validating update requests in laravel. It's implemented using the laravel form request feature which can be implemented using php artisan:make request UpdateBlogPostRequest.
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateBlogPostRequest extends FormRequest {
/**
* Determine if the user is authorized to make this request.
*
@raymond1988
raymond1988 / StoreBlogPostRequest
Last active May 4, 2018 16:06
It's implemented using the laravel form request feature which can be implemented with php artisan:make request command. The code within the rules function checks for validation issues.
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreBlogPostRequest extends FormRequest {
/**
* Determine if the user is authorized to make this request.
@extends('layouts.app')
@section('title', 'Welcome, here is a list of posts')
@section('content')
<div class="col-sm-12">
<ul>
@if($collection)
@foreach ($collection->chunk(3) as $items)
<div class="row row-seperator">
@raymond1988
raymond1988 / multi-step-form.html
Created March 19, 2018 03:12
This html file is a demo of how to implement a multi-step registration form using html, bootstrap, css, jquery and parsley.js
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Multi step/part form designed using bootstrap 4 for responsive and mobile first. This form also includes parseley validation."
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic-bootstrap.min.css">
@raymond1988
raymond1988 / multi-step-form.css
Created March 19, 2018 03:06
multi-step-form.css file contains the css required for the multi-step-form.html file. This form is implemented using html, bootstrap, jquery and parsley.js
#topSpace{
margin-bottom: 8%;
}
.form-section {
/*padding-left: 15px;*/
/*border-left: 2px solid #FF851B;*/
display: none;
}