php.laravel laravel
- good info start here https://www.honeybadger.io/blog/laravel-queues-deep-dive/
- good site - model info https://freek.dev/2332-getting-information-about-all-the-models-in-your-laravel-app
php Artisan tinker example user:
# $laravel artisan tinker # list all method of reflection $methods = (new ReflectionClass('\App\Models\User'))->getMethods(); $u=User::find(5); show $u # show source dump $u # show data show App\Models\User # show source code $u=User::with(['digitalCertificates','roles'])->find(5); # find user with releations and add role $u=User::with(['digitalCertificates','roles'])->find(8); $u->roles()->save(App\Models\Role::find(2)); $u->refresh(); App\Models\Role::create(['id' => 2, 'code' => "archivist",'name' => "Архивист"]); Storage::disk('tinker')->put('users_roles.json', json_encode($data_u, JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE)); # execute code in tinker from file include('/var/www/laravel/storage/app/tinker/update_users.php') ####### - обновление роли #найти пользователя User::with(['roles:id,name'])->where('id','305')->get(['id','name']); User::with('digitalCertificates','roles')->where('name','LIKE', '%Ворончихин%')->first() User::with('Roles')->where('name','LIKE', '%Шестакова%')->get(['id','name']) User::with('Roles:id,name')->where('name','LIKE', '%Долматова%')->first(['id','name']) #Обновление User::where('name','LIKE', '%тампель%')->first()->roles()->detach(Role::where(['code' => 'user'])->first()); User::where('name','LIKE', '%Ворончихин%')->first()->roles()->syncWithoutDetaching(Role::where(['code' => 'user'])->first()); User::find(450)->roles()->syncWithoutDetaching(Role::where(['code' => 'user'])->first()); function addUser($uid) { return User::find($uid)->roles()->syncWithoutDetaching(Role::where(['code' => 'user'])->first()); }
News
laravel.Development
- Laravel's Dependency Injection Container in Depth https://gist.github.com/davejamesmiller/bd857d9b0ac895df7604dd2e63b23afe
- laracast - namespace https://laracasts.com/lessons/namespacing-primer
- laravel json https://laravel.demiart.ru/laravel-mysql-json/
- https://flareapp.io/ignition - error page
- https://habr.com/ru/post/441946/ - api rest laravel
laravel.links
- 20 laravel resources https://kinsta.com/blog/laravel-tutorial/
- laravel 8 blog - https://github.com/guillaumebriday/laravel-blog
- пример готового блога → содержание из markdown - https://github.com/christophrumpel/christoph-rumpel.com
- laravel-form-components - заготовка под формы на tailwind