Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Iman imanghafoori1

🏠
Working from home
  • Freelance
  • The milky way
View GitHub Profile
@imanghafoori1
imanghafoori1 / benchmark.php
Created Jul 31, 2019
compare type hint performance hit
View benchmark.php
<?php
function a1(int $a,int $b) : int {
return $a + $b;
}
function a2( $a, $b){
return $a + $b;
}
View sendAndExit.php
<?php
function sendAndExit($response)
{
$request = app('request');
// send the response to the users browser
app('router')->prepareResponse($request, $response)->send();
// dispatches an event
app('events')->dispatch(new \Illuminate\Foundation\Http\Events\RequestHandled($request, $response));
View LoginController_cleaned.php
<?php
class LoginController
{
function Login(Request $request)
{
$this->validateRequest($request);
$this->throttleAttemps($request);
View LoginController.php
<?php
class AuthController {
public function login(Request $request)
{
$validator = Validator::make($request->all(), [
'email' => 'required|max:255||string',
'password' => 'required|confirmed||string',
]);
if ($validator->fails()) {
@imanghafoori1
imanghafoori1 / formhelper.php
Created Oct 11, 2015
laravel form builder supplimentary
View formhelper.php
<?php
namespace App\Form;
use Kris\LaravelFormBuilder\Form;
/**
* @method FieldOptionSetters text( string $field_name, array $options =[] , boolean $modify = false)
View jade-to-laravel-blade-mixins.jade
//- As you may know, Laravel 5 provides the Elixir to compile assets with no pain.
These mixins is for those of you who want to use Jade power combined with that of Laravel Blade.
The syntax mimic Blade statements, however identation differs in some cases.
- var newline = "\r\n"
- var loopIterator = '$iterator'
//- @extends mixin
Example: +extends('layouts/master')
Compiled: @extends('layouts/master')
View jade-to-laravel-blade-mixins.jade
//- As you may know, Laravel 5 provides the Elixir to compile assets with no pain.
These mixins is for those of you who want to use Jade power combined with that of Laravel Blade.
The syntax mimic Blade statements, however identation differs in some cases.
- var newline = "\r\n"
- var loopIterator = '$iterator'
//- @extends mixin
Example: +extends('layouts/master')
Compiled: @extends('layouts/master')
View jade-to-laravel-blade-mixins.jade
//- As you may know, Laravel 5 provides the Elixir to compile assets with no pain.
These mixins is for those of you who want to use Jade power combined with that of Laravel Blade.
The syntax mimic Blade statements, however identation differs in some cases.
- var newline = "\r\n"
- var loopIterator = '$iterator'
//- @extends mixin
Example: +extends('layouts/master')
Compiled: @extends('layouts/master')