Laravel cheatsheet

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

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();



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中文文档 立即下载

相关推荐

大型国有银行应用系统全链路性能劣化智能根因定位与自愈Agent平台详细设计方案.docx

大型国有银行应用系统全链路性能劣化智能根因定位与自愈Agent平台详细设计方案.docx

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的博客 1580

【深度学习开发环境配置】基于PyTorch的计算机视觉项目依赖管理:requirements.txt文件解析与版本控制方案

内容概要:该文件为一个Python项目的依赖包配置文件(requirements.txt),列出了项目运行所需的软件包及其最低版本要求。主要包括深度学习框架PyTorch及其视觉扩展 torchvision、科学计算库 numpy 和 scipy、数据处理工具 pandas、机器学习库 scikit-learn、图像处理库 opencv-python 和 Pillow,以及数据可视化工具 matplotlib 和 seaborn 等。该配置确保项目在不同环境中具备一致的运行条件。; 适合人群:从事深度学习、计算机视觉或数据科学相关工作的开发者与研究人员,熟悉Python环境管理的技术人员; 使用场景及目标:①用于搭建项目开发环境,确保依赖一致性;②支持模型训练、图像处理、数据分析等任务的环境准备;③便于项目共享与部署,降低环境配置成本; 阅读建议:在实际使用时,建议通过 pip install -r requirements.txt 安装依赖,并根据具体硬件环境适当调整版本兼容性,尤其注意 PyTorch 与 CUDA 版本的匹配。

Laravel cheat sheet

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

weixin_33972649的博客 139

Squareline Studio + LVGL实战:从Figma设计到MCU屏幕的UI开发一条龙(避坑中文显示)

本文详细介绍了使用Squareline Studio和LVGL实现从Figma设计到MCU屏幕UI开发的全流程,重点解决中文显示等常见问题。通过设计工具链搭建、设计稿转换、LVGL工程集成及性能优化等步骤,帮助开发者高效完成嵌入式GUI开发,提升开发效率。

weixin_29246195的博客 598

【老生谈算法】可视化通道流中瞬时涡量场的算法实现与MATLAB源码分析——瞬时涡量场

本文旨在探讨可视化通道流中瞬时涡量场的方法,并通过MATLAB编程实现这一过程。涡量场作为描述流体旋涡强度和方向的重要物理量,对于理解复杂流体运动具有重要意义。本文首先介绍了涡量场的基本概念,随后详细阐述了从测量数据收集到涡量场可视化的完整流程,并给出了相应的MATLAB源码。通过实际运行该源码,我们展示了涡量场的可视化结果,并讨论了其在流动结构识别和动力学行为理解中的应用。关键词: 涡量场;流体运动;MATLAB;可视化;PIV一、引言。

m0_53407570的博客 1131

laravel 速查表

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

chou.yh的博客 383

Unity - gamma space下还原linear space效果

还有头发之后的 (头发没有处理完整,因为使用 ASE 连连看练出来的,使用 surface shader,虽然可以生成一下 vert, frag 的方式在修改,但是我懒得去修改了,这样就是 PBR 的 BRDF 里面的部分曲线是不一样的,所以可以看到头发有一些差异)其实上面的代码判断 是否有分量 > 1.0f 的方式来判断是否 HDR 是不太合理的,因为不同的贴图格式的编码方式不同。还有比较隐蔽的一些颜色相关的常量值 (比如PBR中的 绝缘体的 F0 常量值,等等)

Jave.Lin 的学习笔记 2834

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

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

gitblog_00320的博客 802

RaiDrive+AList保姆级教程:5分钟搞定OneDrive/百度网盘挂载到本地(附WebDAV配置)

本文提供RaiDrive+AList的保姆级教程,5分钟内实现将OneDrive/百度网盘挂载到本地的详细步骤,包括WebDAV配置。通过AList统一转换云存储协议,RaiDrive虚拟磁盘挂载,显著提升多网盘管理效率,适合需要跨平台操作文件的用户。

weixin_28331555的博客 464

手把手教你学Simulink--基于多能源系统协同控制的复杂场景实例:氢燃料电池+锂电池混合动力电动汽车能量管理仿真

本文介绍了基于Simulink的氢燃料电池与锂电池混合动力电动汽车能量管理系统的建模与仿真方法。系统包含驾驶循环输入、燃料电池子系统、锂电池子系统、能量管理、电机驱动等模块,通过协同控制优化能源分配。详细说明了从模型创建到各子系统设置的7个步骤,并提供了MATLAB代码示例。该仿真可评估不同工况下的系统响应速度、能量利用效率和电池寿命等性能指标,为混合动力汽车的能量管理策略设计和优化提供参考。

MHD0815的博客 242

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

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

gitblog_00308的博客 749

手把手教你学AutoSAR - 总目录

鉴于近期较多博友问及微信群,如下可申请好友验证,请备注“autosar”,否则可能添加不通过。验证通过后,拉入讨论群。PS:本人鉴于工作事项可能不能及时回复问题,可在交流群内部和其他博友之间相互沟通交流经验。欢迎来到桃源乐游的《AutoSAR配置与实践》,以下为学习大纲,蓝色字体点击可跳转。

nihaoljq2010的博客 7474

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_...

哲 396

聊聊5G RedCap与eRedCap

而eRedCap作为R18引入的升级版本,进一步将峰值速率限制为10Mbps,仅支持FR1频段,通过减少物理资源块(PRB)数量和优化休眠机制,实现了更低的功耗和成本,成为NB-IoT/LTE-M的理想升级路径。RedCap与eRedCap的出现,正是为了填补“中间地带”—它们既具备高于mMTC的传输速率(接近LTE Cat 4水平),又能实现传统5G NR无法企及的低功耗与低成本,完美适配智能电表、工业网关、智能穿戴设备等“中等需求”物联网设备。时延则低至50ms以下,满足工业机械远程控制的实时性需求。

asd199086的博客 1752

基于Xilinx K7-410T的高速DAC之AD9129开发笔记(一)

引言:从本文开始,我们介绍下项目中设计的并行LVDS高速DAC接口设计,包括DAC与FPGA硬件接口设计、软件设计等。项目设计高速DAC采用了ADI公司的AD9129,该芯片最大更新速率5.7Gsps,该芯片在宽带通信应用、LTE、雷达信号产生、干扰机等领域有广泛应用。

FPGA_Designer 2541

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

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

weixin_30776545的博客 391

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

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

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Laravel event 事件的简单使用

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

读万卷书,行万里路 900

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的博客 5940

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

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

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址