composer install
command in the root folder. Composer will download and install all the dependencies. Route::group(array('domain' => '{account}.myapp.com'), function() { Route::get('user/{id}', function($account, $id) { // }); });
Route::group(array('prefix' => 'admin'), function() { Route::get('user', function() { // }); });
Route::model('user', 'User');
{user}
Route::get('profile/{user}', function(User $user) { // });
User
model by pkcontroller:make
via Artisan CLI php artisan controller:make PhotoController
Route::resource('photo', 'PhotoController');
Type of | Way | Act | Route |
Get | / resource | index | resource.index |
Get | / resource / create | create | resource.create |
POST | / resource | store | resource.store |
Get | / resource / {id} | show | resource.show |
Get | / resource / {id} / edit | edit | resource.edit |
PUT / PATCH | / resource / {id} | update | resource.update |
DELETE | / resource / {id} | destroy | resource.destroy |
Route::controller('users', 'UserController');
controller
method takes two arguments. The first is the base URI that the controller processes, and the second is the controller class name. Next, simply add the methods in the controller, with the prefix corresponding to the HTTP type: class UserController extends BaseController { //GET /user/index public function getIndex() { // } //POST /user/profile public function postProfile() { // } }
UserController
controller action will be processed by the users/admin-profile
URI: public function getAdminProfile() {}
Cache
$value = Cache::get('key');
Illuminate\Support\Facades\Cache
class, you will notice that there is no get
method. class Cache extends Facade { /** * Get the registered name of the component. * * @return string */ protected static function getFacadeAccessor() { return 'cache'; } }
Facade
class, and defines a getFacadeAccessor()
method that returns the name of the key in the IoC container.Cache::get
without using a facade $value = $app->make('cache')->get('key');
Source: https://habr.com/ru/post/181328/
All Articles