flo5581/larahelpers

This package is abandoned and no longer maintained. The author suggests using the flostone/larahelpers package instead.

1.3.0 2017-10-27 13:02 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:47:10 UTC


README

Some custom helpers and functions for Laravel 5

##Installation

Require the package in composer:

composer require flo5581/larahelpers dev-master

Register Service Provider in app.php:

'Flo5581\Larahelpers\BladeExtensions'

##Features

####Laravel functions and definitions:

controller() -> Similar to Route::controller()
controllers() -> Similar to Route::controllers()
get_routes() -> Register multiple GET routes in an array,
example: get_routes(['/' => function(){return view('index');}, 'test' => 'TestController@index']);

post_routes() -> Same as get_routes() but with POST requests instead
group() -> Similar to Route::group()
input() -> Similar to Input::get(), Input::all() (if no value is set)
user() -> Similar to Auth::user()
login() -> Similar to Auth::login() or Auth::loginUsingId() if a User Model or ID is given,
example: login(['email' => $email, 'password' => $password]), login($user), login(1)

logout() -> Similar to Auth::logout()
check() -> Similar to Auth::check()

####New functions and definitions:

days_in_month($month, $year) -> Calculates days in a month, accepts parameter 1: month (int), parameter 2: year (int)
num_to_word($number) -> Converts a number into words

####Blade extensions:

@use(path) -> similar to phps use, example: @use(App\Models\User)
@define(code) -> define variables inside blade, example: @define($i = 1)
@echo(string) -> echo out stuff, example @echo('hi')
@print(var) -> print out stuff, example @print($array)
@dd(var) -> similar to dd(), example: @dd($user)
@php, @endphp -> basically open and close php tags, example: @php echo 'hi'; @endphp