Skip to content

Instantly share code, notes, and snippets.

View ferdiunal's full-sized avatar
🏠
Working from home

Ferdi ÜNAL ferdiunal

🏠
Working from home
View GitHub Profile
<form action="{!! route('admin@settings.general') !!}" method="post" autocomplete="off">
{!! csrf_field() !!}
<div class="form-group">
<label for="site_name">Site Adı : </label>
<input type="text" class="form-control" id="site_name" name="settings[site_name]" placeholder="Site Adı">
@if($errors->has('settings.site_name')) <span class="help-block">{!! $errors->first('settings.site_name') !!}</span> @endif
</div>
<div class="form-group">
<label for="site_slogan">Site Sloganı : </label>
<?php
namespace Unal\Http\Requests\Admin\Settings;
use Unal\Http\Requests\Request;
class General extends Request
{
/**
* Determine if the user is authorized to make this request.
@ferdiunal
ferdiunal / post.js
Last active April 16, 2016 15:28
Laravel ile ajax işlemi
/**
* index.blade.php'de jQuery'nin yüklü olması gerekiyor.
* index.blade.php'de head tagları arasına
* <meta name="_token" content="{!! csrf_token !!}" /> 'i ekliyoruz
*/
$.ajaxSetup({
// Ajax Post işlemi sırasında Laravel'in TokenMismatchException hatası vermemesi için
'datatype' :'json',
'method' : 'post',
<?php
Route::group(['middleware' => 'web'],function(){
Route::get('post',['as' => 'post.index','uses' => 'PostController@index']); // Burada Post sayfasını görüntüleyeceğiz.
Route::post('post',['middleware' => 'throttle:5','uses' => 'PostController@store']) // middleware eklememizin sebebi, art arda sunucu istekleini engellemek
});
<?php
namespace App\Http\Controllers;
use App\Http\Requests\Post as Request;
use App\Http\Controllers\Controller;
class PostController extends Controller
{
public function index(){
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
class Post extends Request
{
/**
* Determine if the user is authorized to make this request.
<!doctype html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="author" content="Ferdi ÜNAL">
<meta name="_token" content="{!! csrf_token() !!}">
<title>Post</title>
</head>
<body>
@ferdiunal
ferdiunal / kernel.php
Created April 25, 2016 20:56
Kernel.php
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
<?php
namespace Bootstrap;
class Application extends Illuminate\Foundation\Application
{
/**
* The Laravel framework version.
*
* @var string
*/
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
# Update Package List
apt-get update
# Update System Packages
apt-get -y upgrade