flostone / larahelpers
Installs: 18
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/flostone/larahelpers
Requires
- php: >=5.4.0
- illuminate/http: ~5.0
- illuminate/session: ~5.0
- illuminate/support: ~5.0
This package is not auto-updated.
Last update: 2020-09-05 07:01:11 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