Laravel cheatsheet

laravel5-cheatsheet:Laravel 5.1 LTS的快速参考指南(速查表),列出了工匠,作曲家,路线和其他有用的信息 创造不息,交付不止 介绍 Laravel 5.1 LTS的快速参考指南(速查表),列出了工匠,作曲家,路线和其他有用的信息。 我们打算构建此备忘单,使其更易于评估和用户友好,您可以使用现代台式机进行查看 :laptop: 浏览器和移动设备 :mobile_phone: 。 :red_heart: 该项目由和维护,我们都是。 仅支持Laravel 5.1 LTS 欢迎使用Pull Request,但是由于Laravel 5.1是长期支持版本,因此直到2018年我们才支持其他版本,感谢您的理解:) 是的,我们喜欢LTS :sparkles: :sparkles: :sparkles: 现场版本: 英文: : 中文版本: : 感谢 -Laravel中文社区 -Laravel中文文档 立即下载

Laravel底层使用了symfony框架,symfony框架提供了支持路由的MVC的基础框架,而在此基础上Laravel提供了更为丰富的功能,某些功能基础一些,使用一些比较成熟的PHP库。最终Laravel提供了诸如认证、缓存、配置、Cookie、加密、日志、邮件、视图模板等众多功能,从而简化PHP的开发工作。

对于依赖的众多三方库,框架采用了IoC的方式,相关类型通过IoC动态的生成注入,并且通过Facade提供干净的使用接口。

http://cheats.jesse-obrien.ca/


Artisan 
php artisan --help OR -h
php artisan --quiet OR -q
php artisan --version OR -V
php artisan --no-interaction OR -n
php artisan --ansi
php artisan --no-ansi
php artisan --env
php artisan --verbose

php artisan changes
php artisan clear-compiled
php artisan down
php artisan dump-autoload
php artisan env
php artisan help
php artisan list
php artisan migrate
php artisan optimize
php artisan routes
php artisan serve
php artisan tinker
php artisan up
php artisan workbench

php artisan asset:publish [--bench[="vendor/package"]] [--path[="..."]] [package]
php artisan auth:reminders-table
php artisan cache:clear
php artisan command:make name [--command[="..."]] [--path[="..."]] [--namespace[="..."]]
php artisan config:publish
php artisan controller:make [--bench="vendor/package"]
php artisan db:seed [--class[="..."]] [--database[="..."]]
php artisan key:generate
php artisan migrate [--bench="vendor/package"] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]
php artisan migrate:install [--database[="..."]]
php artisan migrate:make name [--bench="vendor/package"] [--create] [--package[="..."]] [--path[="..."]] [--table[="..."]]
php artisan migrate:refresh [--database[="..."]] [--seed]
php artisan migrate:reset [--database[="..."]] [--pretend]
php artisan migrate:rollback [--database[="..."]] [--pretend]
php artisan queue:listen [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--timeout[="..."]] [connection]
php artisan queue:subscribe [--type[="..."]] queue url
php artisan queue:work [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--sleep] [connection]
php artisan session:table
php artisan view:publish [--path[="..."]] package
php artisan tail [--path[="..."]] [--lines[="..."]] [connection]
			
Composer 
composer create-project laravel/laravel folder_name
composer install
composer update
composer dump-autoload [--optimize]
composer self-update
			
Routing 
Route::get('foo', function(){});
Route::get('foo', 'ControllerName@function');
Route::controller('foo', 'FooController');
Route::resource('posts',' 'PostsController');
			
Triggering Errors
App::abort(404);
App::missing(function($exception){});
throw new NotFoundHttpException;
			
Route Parameters
Route::get('foo/{bar}', function($bar){});
Route::get('foo/{bar?}', function($bar = 'bar'){});
			
HTTP Verbs
Route::any('foo', function(){});
Route::post('foo', function(){});
Route::put('foo', function(){});
Route::patch('foo', function(){});
Route::delete('foo', function(){});
Route::resource('foo', 'FooController');
			
Secure Routes
Route::get('foo', array('https', function(){}));
Route Constraints
Route::get('foo/{bar}', function($bar){})
	->where('bar', '[0-9]+');
Route::get('foo/{bar}/{baz}', function($bar, $baz){})
	->where(array('bar' => '[0-9]+', 'baz' => '[A-Za-z]'))
			
Route::pattern('bar', '[0-9]+')
			
Filters
Route::filter('auth', function(){});
Route::filter('foo', 'FooFilter');
Route::get('foo', array('before' => 'auth', function(){}));
Route::get('foo', array('before' => 'auth', function(){}));
Route::group(array('before' => 'auth'), function(){});
Route::when('foo/*', 'foo');
Route::when('foo/*', 'foo', array('post'));
			
Named Routes
Route::currentRouteName();
Route::get('foo/bar', array('as' => 'foobar', function(){}));
			
Route Prefixing
Route::group(array('prefix' => 'foo'), function(){})
			
Sub-Domain Routing
Route::group(array('domain' => '{sub}.example.com'), function(){});
			
URLs 
URL::full();
URL::current();
URL::previous();
URL::to('foo/bar', $parameters, $secure);
URL::action('FooController@method', $parameters, $absolute);
URL::route('foo', $parameters, $absolute);
URL::secure('foo/bar', $parameters);
URL::asset('css/foo.css', $secure);
URL::secureAsset('css/foo.css');
URL::isValidUrl('http://example.com');
URL::getRequest();
URL::setRequest($request);
URL::getGenerator();
URL::setGenerator($generator);
			
Events 
Event::fire('foo.bar', array($bar));
Event::listen('foo.bar', function($bar){});
Event::listen('foo.*', function($bar){});
Event::listen('foo.bar', 'FooHandler', 10);
Event::listen('foo.bar', 'BarHandler', 5);
Event::listen('foor.bar', function($event){ return false; });
Event::queue('foo', array($bar));
Event::flusher('foo', function($bar){});
Event::flush('foo');
Event::forget('foo');
Event::subscribe(new FooEventHandler);
			
Database 
DB::connection('connection_name');
DB::statement('drop table users');
DB::listen(function($sql, $bindings, $time){ code_here; });
DB::transaction(function(){ transaction_code_here; });
DB::table('users')->remember($time)->get();
DB::raw('sql expression here');
			
Selects
DB::table('name')->get();
DB::table('name')->distinct()->get();
DB::table('name')->select('column as column_alias')->get();
DB::table('name')->where('name', '=', 'John')->get();
DB::table('name')->whereBetween('column', array(1, 100))->get();
DB::table('name')->whereIn('column', array(1, 2, 3))->get();
DB::table('name')->whereNotIn('column', array(1, 2, 3))->get();
DB::table('name')->whereNull('column')->get();
DB::table('name')->whereNotNull('column')->get();
DB::table('name')->groupBy('column')->get();
DB::table('name')->orderBy('column')->get();
DB::table('name')->having('count', '>', 100)->get();
DB::table('name')->skip(10)->take(5)->get();
DB::table('name')->first();
DB::table('name')->pluck('column');
DB::table('name')->lists('column');
DB::table('name')->join('table', 'name.id', '=', 'table.id')
    ->select('name.id', 'table.email');
			
Inserts, Updates, Deletes
DB::table('name')->insert(array('name' => 'John', 'email' => 'john@example.com'));
DB::table('name')->insertGetId(array('name' => 'John', 'email' => 'john@example.com'));
DB::table('name')->insert(
	array('name' => 'John', 'email' => 'john@example.com')
	array('name' => 'James', 'email' => 'james@example.com')
);
DB::table('name')->where('name', '=', 'John')
	->update(array('email' => 'john@example2.com'));
DB::table('name')->delete();
DB::table('name')->where('id', '>', '10')->delete();
DB::table('name')->truncate();
			
Aggregates
DB::table('name')->count();
DB::table('name')->max('column');
DB::table('name')->min('column');
DB::table('name')->avg('column');
DB::table('name')->sum('column');
DB::table('name')->increment('column');
DB::table('name')->increment('column', $amount);
DB::table('name')->decrement('column');
DB::table('name')->decrement('column', $amount);
DB::table('name')->remember(5)->get();
DB::table('name')->remember(5, 'cache-key-name')->get();
DB::table('name')->cacheTags('my-key')->remember(5)->get();
DB::table('name')->cacheTags(array('my-first-key','my-second-key'))->remember(5)->get();
			
Raw Expressions
DB::select('select * from users where id = ?', array('value'));
DB::table('name')->select(DB::raw('count(*) as count, column2'))->get();
			
Eloquent 
Model::create(array('key' => 'value'));
Model::fill($attributes);
Model::destroy(1);
Model::all();
Model::find(1);
Model::find(array('first', 'last'));
Model::findOrFail(1);
Model::findOrFail(array('first', 'last'));
Model::where('foo', '=', 'bar')->get();
Model::where('foo', '=', 'bar')->first();
Model::where('foo', '=', 'bar')->firstOrFail();
Model::where('foo', '=', 'bar')->count();
Model::where('foo', '=', 'bar')->delete();
Model::whereRaw('foo = bar and cars = 2', array(20))->get();
Model::remember(5)->get();
Model::remember(5, 'cache-key-name')->get();
Model::cacheTags('my-tag')->remember(5)->get();
Model::cacheTags(array('my-first-key','my-second-key'))->remember(5)->get();
Model::on('connection-name')->find(1);
Model::with('relation')->get();
Model::all()->take(10);
Model::all()->skip(10);
			
Soft Delete
Model::withTrashed()->where('cars', 2)->get();
Model::withTrashed()->where('cars', 2)->restore();
Model::where('cars', 2)->forceDelete();
Model::onlyTrashed()->where('cars', 2)->get();
			
Events
Model::creating(function($model){});
Model::created(function($model){});
Model::updating(function($model){});
Model::updated(function($model){});
Model::saving(function($model){});
Model::saved(function($model){});
Model::deleting(function($model){});
Model::deleted(function($model){});
Model::observe(new FooObserver);
			
Eloquent Configuration
Eloquent::unguard();
Eloquent::reguard();
The Remote Component 
Executing Commands
SSH::run(array $commands);
SSH::into($remote)->run(array $commands); 
SSH::run(array $commands, function($line)
{
	echo $line.PHP_EOL;
});
			
Tasks
SSH::define($taskName, array $commands); 
SSH::task($taskName, function($line)  {
	echo $line.PHP_EOL;
});
			
SFTP Uploads
SSH::put($localFile, $remotePath);
SSH::putString($string, $remotePath);
			
Schema 
Schema::create('table', function($table)
{
    $table->increments('id');
});
Schema::connection('foo')->create('table', function($table){});
Schema::rename($from, $to);
Schema::drop('table');
Schema::dropIfExists('table');
Schema::hasTable('table');
Schema::hasColumn('table', 'column');
Schema::table('table', function($table){});
$table->renameColumn('from', 'to');
$table->dropColumn(string|array);
$table->engine = 'InnoDB';
$table->string('name')->after('email');
			
Indexes
$table->string('column')->unique();
$table->primary('column');
$table->primary(array('first', 'last'));
$table->unique('column');
$table->unique('column', 'key_name');
$table->unique(array('first', 'last'));
$table->unique(array('first', 'last'), 'key_name');
$table->index('column');
$table->index('column', 'key_name');
$table->index(array('first', 'last'));
$table->index(array('first', 'last'), 'key_name');
$table->dropPrimary('table_column_primary');
$table->dropUnique('table_column_unique');
$table->dropIndex('table_column_index');
			
Foreign Keys
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->dropForeign('posts_user_id_foreign');
			
Column Types
$table->increments('id');
$table->bigIncrements('id');
$table->string('email');
$table->string('name', 100);
$table->integer('votes');
$table->bigInteger('votes');
$table->smallInteger('votes');
$table->float('amount');
$table->double('column', 15, 8);
$table->decimal('amount', 5, 2);
$table->boolean('confirmed');
$table->date('created_at');
$table->dateTime('created_at');
$table->time('sunrise');
$table->timestamp('added_on');
$table->timestamps();
$table->softDeletes();
$table->text('description');
$table->binary('data');
$table->enum('choices', array('foo', 'bar'));
$table->morphs('parent');
->nullable()
->default($value)
->unsigned()
			
Input 
Input::get('key');
Input::get('key', 'default');
Input::has('key');
Input::all();
Input::only('foo', 'bar');
Input::except('foo');
			
Session Input (flash)
Input::flash();
Input::flashOnly('foo', 'bar');
Input::flashExcept('foo', 'baz');
Input::old('key','default_value');
			
Files
Input::file('filename');
Input::hasFile('filename');
Input::file('name')->getRealPath();
Input::file('name')->getClientOriginalName();
Input::file('name')->getClientOriginalExtension();
Input::file('name')->getSize();
Input::file('name')->getMimeType();
Input::file('name')->move($destinationPath);
Input::file('name')->move($destinationPath, $fileName);
			
Cache 
Cache::put('key', 'value', $minutes);
Cache::add('key', 'value', $minutes);
Cache::forever('key', 'value');
Cache::remember('key', $minutes, function(){ return 'value' });
Cache::rememberForever('key', function(){ return 'value' });
Cache::forget('key');
Cache::has('key');
Cache::get('key');
Cache::get('key', 'default');
Cache::get('key', function(){ return 'default'; });
Cache::tag('my-tag')->put('key','value', 10);
Cache::tag('my-tag')->get('key');
Cache::tag('my-tag')->flush();
Cache::increment('key');
Cache::increment('key', $amount);
Cache::decrement('key');
Cache::decrement('key', $amount);
Cache::section('group')->put('key', $value);
Cache::section('group')->get('key');
Cache::section('group')->flush();
			
Cookies 
Cookie::get('key');
Cookie::forever('key', 'value');
Cookie::queue('key', 'value', 'minutes');
$response = Response::make('Hello World');
$response->withCookie(Cookie::make('name', 'value', $minutes));
			
Sessions 
Session::get('key');
Session::get('key', 'default');
Session::get('key', function(){ return 'default'; });
Session::put('key', 'value');
Session::push('foo.bar','value');
Session::all();
Session::has('key');
Session::forget('key');
Session::flush();
Session::regenerate();
Session::flash('key', 'value');
Session::reflash();
Session::keep(array('key1', 'key2'));
			
Requests 
Request::path();
Request::is('foo/*');
Request::url();
Request::segment(1);
Request::header('Content-Type');
Request::server('PATH_INFO');
Request::ajax();
Request::secure();
			
Responses 
return Response::make($contents);
return Response::make($contents, 200);
return Response::json(array('key' => 'value'));
return Response::json(array('key' => 'value'))
	->setCallback(Input::get('callback'));
return Response::download($filepath);
return Response::download($filepath, $filename, $headers);
$response = Response::make($contents, 200);
$response->header('Content-Type', 'application/json');
return $response;
return Response::make($content)
	->withCookie(Cookie::make('key', 'value'));
			
Redirects 
return Redirect::to('foo/bar');
return Redirect::to('foo/bar')->with('key', 'value');
return Redirect::to('foo/bar')->withInput(Input::get());
return Redirect::to('foo/bar')->withInput(Input::except('password'));
return Redirect::to('foo/bar')->withErrors($validator);
return Redirect::back();
return Redirect::route('foobar');
return Redirect::route('foobar', array('value'));
return Redirect::route('foobar', array('key' => 'value'));
return Redirect::action('FooController@index');
return Redirect::action('FooController@baz', array('value'));
return Redirect::action('FooController@baz', array('key' => 'value'));
return Redirect::intended('foo/bar');
			
IoC 
App::bind('foo', function($app){ return new Foo; });
App::make('foo');
App::make('FooBar');
App::singleton('foo', function(){ return new Foo; });
App::instance('foo', new Foo);
App::bind('FooRepositoryInterface', 'BarRepository');
App::register('FooServiceProvider');
App::resolving(function($object){});
			
Security 
Passwords
Hash::make('secretpassword');
Hash::check('secretpassword', $hashedPassword);
Hash::needsRehash($hashedPassword);
			
Auth
Auth::check();
Auth::user();
Auth::attempt(array('email' => $email, 'password' => $password));
Auth::attempt($credentials, true);
Auth::once($credentials);
Auth::login(User::find(1));
Auth::loginUsingId(1);
Auth::logout();
Auth::validate($credentials);
Auth::basic('username');
Auth::onceBasic();
Password::remind($credentials, function($message, $user){});
			
Encryption
Crypt::encrypt('secretstring');
Crypt::decrypt($encryptedString);
Crypt::setMode('ctr');
Crypt::setCipher($cipher);
			
Mail 
Mail::send('email.view', $data, function($message){});
Mail::send(array('html.view', 'text.view'), $data, $callback);
Mail::queue('email.view', $data, function($message){});
Mail::queueOn('queue-name', 'email.view', $data, $callback);
Mail::later(5, 'email.view', $data, function($message){});
Mail::pretend();
			
Messages
$message->from('email@example.com', 'Mr. Example');
$message->sender('email@example.com', 'Mr. Example');
$message->returnPath('email@example.com');
$message->to('email@example.com', 'Mr. Example');
$message->cc('email@example.com', 'Mr. Example');
$message->bcc('email@example.com', 'Mr. Example');
$message->replyTo('email@example.com', 'Mr. Example');
$message->subject('Welcome to the Jungle');
$message->priority(2);
$message->attach('foo\bar.txt', $options);
$message->attachData('bar', 'Data Name', $options);
$message->embed('foo\bar.txt');
$message->embedData('foo', 'Data Name', $options);
$message->getSwiftMessage();
            
Queues 
Queue::push('SendMail', array('message' => $message));
Queue::push('SendEmail@send', array('message' => $message));
Queue::push(function($job) use $id {});
php artisan queue:listen
php artisan queue:listen connection
php artisan queue:listen --timeout=60
php artisan queue:work
			
Validation 
Validator::make(
	array('key' => 'Foo'),
	array('key' => 'required|in:Foo')
);
Validator::extend('foo', function($attribute, $value, $params){});
Validator::extend('foo', 'FooValidator@validate');
Validator::resolver(function($translator, $data, $rules, $msgs)
{
	return new FooValidator($translator, $data, $rules, $msgs);
});
			
Rules
accepted
active_url
after:YYYY-MM-DD
before:YYYY-MM-DD
alpha
alpha_dash
alpha_num
between:1,10
confirmed
date
date_format:YYYY-MM-DD
different:fieldname
email
exists:table,column
image
in:foo,bar,baz
not_in:foo,bar,baz
integer
numeric
ip
max:value
min:value
mimes:jpeg,png
regex:[0-9]
required
required_if:field,value
required_with:foo,bar,baz
required_without:foo,bar,baz
same:field
size:value
unique:table,column,except,idColumn
url

			
Views 
View::make('path/to/view');
View::make('foo/bar')->with('key', 'value');
View::make('foo/bar')->withKey('value');
View::make('foo/bar', array('key' => 'value'));
View::exists('foo/bar');
View::share('key', 'value');
View::make('foo/bar')->nest('name', 'foo/baz', $data);
View::composer('viewname', function($view){});
View::composer(array('view1', 'view2'), function($view){});
View::composer('viewname', 'FooComposer');
View::creator('viewname', function($view){});
			
Blade Templates 
@extends('layout.name')
@section('name')
@stop
@show
@parent
@yield('name')
@include('view.name')
@include('view.name', array('key' => 'value'));
@lang('messages.name')
@choice('messages.name', 1);
@if
@else
@elseif
@endif
@unless
@endunless
@for
@endfor
@foreach
@endforeach
@while
@endwhile
{{ $var }}
{{{ $var }}}
{{-- Blade Comment --}}
{{{ $name or 'Default' }}}
@{{ This will not be processed by Blade }}
			
Forms 
Form::open(array('url' => 'foo/bar', 'method' => 'PUT'));
Form::open(array('route' => 'foo.bar'));
Form::open(array('route' => array('foo.bar', $parameter)));
Form::open(array('action' => 'FooController@method'));
Form::open(array('action' => array('FooController@method', $parameter)));
Form::open(array('url' => 'foo/bar', 'files' => true));
Form::close();
Form::token();
Form::model($foo, array('route' => array('foo.bar', $foo->bar)));

			
Form Elements
Form::label('id', 'Description');
Form::label('id', 'Description', array('class' => 'foo'));
Form::text('name');
Form::text('name', $value);
Form::text('name', $value, array('class' => 'name'));
Form::textarea('name');
Form::textarea('name', $value);
Form::textarea('name', $value, array('class' => 'name'));
Form::hidden('foo', $value);
Form::password('password');
Form::password('password', array('placeholder' => 'Password'));
Form::email('name', $value, array());
Form::file('name', array('class' => 'name'));
Form::checkbox('name', 'value');
Form::checkbox('name', 'value', true, array('class' => 'name'));
Form::radio('name', 'value');
Form::radio('name', 'value', true, array('class' => 'name'));
Form::select('name', array('key' => 'value'));
Form::select('name', array('key' => 'value'), 'key', array('class' => 'name'));
Form::submit('Submit!');
Form::macro('fooField', function()
{
	return '<input type="custom"/>';
});
Form::fooField();
			
HTML Builder
HTML::macro('name', function(){});
HTML::entities($value);
HTML::decode($value);
HTML::script($url, $attributes);
HTML::style($url, $attributes);
HTML::image($url, $alt, $attributes);
HTML::link($url, 'title', $attributes, $secure);
HTML::secureLink($url, 'title', $attributes);
HTML::linkAsset($url, 'title', $attributes, $secure);
HTML::linkSecureAsset($url, 'title', $attributes);
HTML::linkRoute($name, 'title', $parameters, $attributes);
HTML::linkAction($action, 'title', $parameters, $attributes);
HTML::mailto($email, 'title', $attributes);
HTML::email($email);
HTML::ol($list, $attributes);
HTML::ul($list, $attributes);
HTML::listing($type, $list, $attributes);
HTML::listingElement($key, $type, $value);
HTML::nestedListing($key, $type, $value);
HTML::attributes($attributes);
HTML::attributeElement($key, $value);
HTML::obfuscate($value);
			
Strings 
Str::ascii($value)
Str::camel($value)
Str::contains($haystack, $needle)
Str::endsWith($haystack, $needles)
Str::finish($value, $cap)
Str::is($pattern, $value)
Str::length($value)
Str::limit($value, $limit = 100, $end = '...')
Str::lower($value)
Str::words($value, $words = 100, $end = '...')
Str::plural($value, $count = 2)
Str::random($length = 16)
Str::quickRandom($length = 16)
Str::upper($value)
Str::title($value)
Str::singular($value)
Str::slug($title, $separator = '-')
Str::snake($value, $delimiter = '_')
Str::startsWith($haystack, $needles)
Str::studly($value)
Str::macro($name, $macro)
			
Localization 
App::setLocale('en');
Lang::get('messages.welcome');
Lang::get('messages.welcome', array('foo' => 'Bar'));
Lang::has('messages.welcome');
Lang::choice('messages.apples', 10);
			
Files 
File::exists('path');
File::get('path');
File::getRemote('path');
File::getRequire('path');
File::requireOnce('path');
File::put('path', 'contents');
File::append('path', 'data');
File::delete('path');
File::move('path', 'target');
File::copy('path', 'target');
File::extension('path');
File::type('path');
File::size('path');
File::lastModified('path');
File::isDirectory('directory');
File::isWritable('path');
File::isFile('file');
File::glob($patterns, $flag);
File::files('directory');
File::allFiles('directory');
File::directories('directory');
File::makeDirectory('path',  $mode = 0777, $recursive = false);
File::copyDirectory('directory', 'destination', $options = null);
File::deleteDirectory('directory', $preserve = false);
File::cleanDirectory('directory');
			
Helpers 
Arrays
array_add($array, 'key', 'value');
array_build($array, function(){});
array_divide($array);
array_dot($array);
array_except($array, array('key'));
array_fetch($array, 'key');
array_first($array, function($key, $value){}, $default);
array_flatten($array);
array_forget($array, 'foo');
array_forget($array, 'foo.bar');
array_get($array, 'foo', 'default');
array_get($array, 'foo.bar', 'default');
array_only($array, array('key'));
array_pluck($array, 'key');
array_pull($array, 'key');
array_set($array, 'key', 'value');
array_set($array, 'key.subkey', 'value');
array_sort($array, function(){});
head($array);
last($array);
			
Paths
app_path();
public_path();
base_path();
storage_path();
			
Strings
camel_case($value);
class_basename($class);
e('<html>');
starts_with('Foo bar.', 'Foo');
ends_with('Foo bar.', 'bar.');
snake_case('fooBar');
str_contains('Hello foo bar.', 'foo');
str_finish('foo/bar', '/');
str_is('foo*', 'foobar');
str_plural('car');
str_random(25);
str_singular('cars');
studly_case('foo_bar');
trans('foo.bar');
trans_choice('foo.bar', $count);
			
URLs and Links
action('FooController@method', $parameters);
link_to('foo/bar', $title, $attributes, $secure);
link_to_asset('img/foo.jpg', $title, $attributes, $secure);
link_to_route('route.name', $title, $parameters, $attributes);
link_to_action('FooController@method', $title, $params, $attrs);
asset('img/photo.jpg', $title, $attributes);
secure_asset('img/photo.jpg', $title, $attributes);
secure_url('path', $parameters);
route($route, $parameters, $absolute = true);
url('path', $parameters = array(), $secure = null);
		
Miscellaneous
csrf_token();
dd($value);
value(function(){ return 'bar'; });
with(new Foo)->chainedMethod();



laravel-cheatsheet:Laravel备忘单 Laravel备忘单 最后是Laravel 4的备忘单。请记住,这是一项正在进行中的工作,将会相当动态。 它将密切关注文档,我将尝试通过添加新功能来使其保持最新。 现场版本: 贡献 如果您看到错字或希望添加/更改任何内容,请打开一个问题或弹出一个拉取请求。 谢谢! 立即下载

相关推荐

国央企创新负责人如何通过平台实现科研成果的快速识别与转化?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

luckysheet部署在laravel上

应用luckysheet JS CSS 文件到本地内联代码片上述可以换成自己的本地下载。下面是提示框样式的引用 ,我也下载到本地了。内联代码片-- 提示弹框换成本地数据源 -- > < link rel = "stylesheet" type = "text/css" href = "../css/toastify.css" > < script type = "text/javascript" src = "../js/toastify.js" > < / script >实例化图表的语句。

qq_43431497的博客 1578

PotPlayer自用皮肤

自用 PotPlayer 皮肤,仅微调了字体大小与颜色,是按个人习惯调整,未做适配性调整。

Laravel cheat sheet

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33972649的博客 139

Cadence 17.2 OrCAD原理图库实战:从零创建电阻/电容/LED元件(附封装技巧)

本文以Cadence 17.2 OrCAD为核心,详细讲解了如何从零开始工程化地创建电阻、电容、LED等原理图库元件。内容涵盖库架构设计、符号绘制、引脚属性管理、封装关联技巧以及设计规则检查,旨在帮助硬件工程师构建规范、可复用且易于维护的元件库,为高效PCB设计奠定坚实基础。

weixin_29195615的博客 400

Rockchip MPP解码H264实战:从文件到YUV的完整流程解析

本文详细解析了在Rockchip平台上使用MPP(Media Process Platform)硬件解码H264视频文件并输出YUV数据的完整流程。通过实战代码示例,深入讲解了MPP解码器的初始化、数据包投递、非阻塞模式下的双循环控制以及YUV帧的提取与保存等核心步骤,并提供了环境搭建、编译运行和常见问题排查指南,帮助开发者高效利用硬件加速进行视频处理。

life6的博客 479

laravel 速查表

https://learnku.com/docs/laravel-cheatsheet/6.0

chou.yh的博客 383

从零开始:EAS2+Elmo+Maxon电机调试全流程(含电流环优化技巧)

本文详细解析了从零开始搭建基于EAS2软件、Elmo驱动器和Maxon电机的运动控制系统的全流程。内容涵盖硬件连接规范、EAS2基础配置、核心的电流环模型辨识与手动优化技巧,以及速度环、位置环的搭建与调试策略,旨在帮助工程师构建稳定、高性能的伺服控制核心。

i0j1k2l3m的博客 502

Modern PHP Cheatsheet终极教程:15个核心概念快速掌握

Modern PHP Cheatsheet是一份面向现代项目的PHP速查指南,专为已有基础的开发者设计,帮助他们快速掌握现代PHP代码库中常见的新特性和概念。本教程将通过15个核心概念,带你轻松跨越从基础PHP到现代PHP开发的鸿沟,让你在Laravel、Symfony等主流框架中游刃有余。 ## 🚀 为什么需要学习现代PHP? 随着PHP版本的不断迭代(目前最新稳定版为PHP 8.3),语

gitblog_00320的博客 801

无线自组织网络基础知识

参考书籍:《无线自组织网络路由协议及应用》 目录第一章 绪论1.1 无线自组织网络概述1.1.1 无线自组织网络的定义及分类1.1.2无线自组织网络的主要特点1.1.3无线自组织网络的应用与发展1.无线自组织网络的应用2.无线自组织网络的起源和发展1.2典型的无线自组织网络1.2.1移动Ad Hoc网络1、移动Ad Hoc网络的定义2.移动AdHoc网络的特点3.移动Ad Hoc网络的应用1.2....

逸凌Time 2万+

keil+Jlink GD32调试记录

Jlink+keil,GD32调试记录,踩坑及解决,持续更新。

SUN_BW的博客 2952

PHP The Right Way社区资源大全:从框架到组件的完整生态指南

PHP The Right Way是一个汇集PHP最佳实践、编码规范和权威学习指南的开源项目,旨在为PHP开发者提供清晰、简洁的学习资源。无论是刚入门的新手还是有经验的开发者,都能从中找到提升技能的实用内容。通过本指南,你将全面了解PHP生态系统中的框架、组件、学习资源和社区支持,助你快速掌握PHP开发的正确路径。 [![PHP生态系统概览](https://raw.gitcode.com/gh

gitblog_00308的博客 748

基于SolidWorks宏的草图点坐标自动化提取与Excel集成

本文详细介绍了如何利用SolidWorks宏编程实现草图点坐标的自动化提取并与Excel集成,显著提升机械设计效率。通过VBA代码解析与优化,解决了人工记录坐标耗时易错的问题,并扩展了多草图批量处理、数据可视化等高级功能,适用于数控加工、质量检测等场景。

weixin_29251131的博客 461

Eloquent Cheat Sheet

转载自:http://laragems.com/post/eloquent-cheat-sheet Select -&gt;select('col1','col2') -&gt;select(array('col1','col2')) -&gt;select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_...

哲 395

嵌入式SDIO 总线面试题及参考答案

SDIO 的 4 位总线模式是一种提高数据传输效率的工作模式。在传统的 1 位总线模式下,数据只能通过一根数据线(DAT0)进行传输,这限制了数据传输的带宽和速度。而在 4 位总线模式下,DAT0 - DAT3 这 4 根数据线同时用于数据传输,相当于在同一时间内可以传输 4 倍于 1 位模式的数据量,从而显著提高了数据传输的带宽和速度。要通过 CMD6 命令将 SDIO 总线从当前模式切换到 4 位总线模式,需要遵循以下步骤:第一步,主设备需要确保 SDIO 卡支持 4 位总线模式。

大模型大数据攻城狮的专栏 1719

【QGIS】软件下载安装及GIS4WRF插件使用

【QGIS】软件下载安装及GIS4WRF插件使用

WW、forever的博客 1799

Tailwind CSS本质:Utility-First设计系统实战指南

Utility-First CSS是一种以原子化工具类为基石的样式开发范式,其核心在于将设计系统拆解为可组合、可复用的视觉单元,而非预设语义化组件。它通过预定义的间距、颜色、响应式断点等基础能力,实现HTML内联声明式样式表达,显著降低CSS优先级冲突与命名焦虑。技术价值体现在协作提效(设计师与前端共用同一套设计令牌)、维护降本(无样式污染、零CSS文件修改)及性能可控(JIT按需生成、体积压缩率超85%)。典型应用场景包括SaaS后台快速迭代、无障碍友好型响应式布局、深色模式无缝切换及跨框架(React/

weixin_30776545的博客 389

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

laravel小抄

原文地址:http://cheats.jesse-obrien.ca/ Artisan // Displays help for a given command php artisan --help OR -h // Do not output any message php artisan --quiet OR -q // Display this application v...

weixin_34327223的博客 348

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Laravel event 事件的简单使用

有时候当我们单纯的看 Laravel手册的时候会有一些疑惑,比如说系统服务下的授权和事件,这些功能服务的应用场景是什么,其实如果没有经历过一定的开发经验有这些疑惑是很正常的事情,但是当我们在工作中多加思考会发现有时候这些服务其实我们一直都见过。下面就事件、事件监听举一个很简单的例子你就会发现。 ​ 这个例子是关于文章的浏览数的实现,当用户查看文章的时候文章的浏览数会增加1,用户查看文章就是一个事件,有了事件,就需要一个事件监听器,对监听的事件发生后执行相应的操作(文章浏览数加1),其实这种监听机制在 La.

读万卷书,行万里路 899

Laravel 速查表 Event

// 1. EventServiceProvider 类里的 $listen 属性 protected $listen =['App\Events\OrderShipped' => ['App\Listeners\SendShipmentNotification']]; // 2. 生成监听类 php artisan event:generate // 触发命令 Event::fire(...

六月的雨 454

laravel-excel文档翻译笔记

1.安装 1>composer 安装 "maatwebsite/excel": "~2.1.0" 2>app/config/app.php,添加服务 Maatwebsite\Excel\ExcelServiceProvider::class 设置Facade: 'Excel' => Maatwebsite\Excel\Facades\Excel::class, 这样,就

beyond__devil的博客 5939

laravel导入excel中多个sheet

导入excel多个sheet Excel::load($excel_file_path, function ($reader) use (&$res) { $count = $reader->getSheetCount(); // $reader = $reader->getSheet(1); // $res = $reader->toArray(); .

渡目成书 2197

Laravel 中的event事件概念

概述 事件是一种常见的观察者模式的应用。简单的来说,当 (event)… 干 (listener)… 放置 event 和 listener 文件的位置分别是: app/Events app/Listeners 这些目录只有当你使用 Artisan 命令来生成事件和监听器时才会被自动创建。 对于产品经理来说,事件主要用来规范你的业务逻辑,使支线逻辑与主线逻辑独立分拆。对于程序员来说,事件可以让 Controller 变得非常简洁,解耦,可维护。 定义事件 (Event) 一.注册事件和监听器 Larav

weixin_46044420的博客 2272

Laravel 中使用原生的 PHPExcel

1、安装composer require maatwebsite/excel 之后,程序中就可以使用 PHPExcel 了2、控制器中public function export(Request $request){ $Excel = new \PHPExcel(); $Excel->setActiveSheetIndex(0); $sheet = $Excel->g...

weixin_30906425的博客 472
上一篇: PHP学习之九:扩展函数库之字符串与数据库访问等
下一篇: 使用SSH进行端口转发
zzulp
博客等级 码龄19年 464粉丝 176原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值