Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
programming:phplaravel [2022/09/10 14:08] – [php.laravel laravel] admin | programming:phplaravel [2022/09/19 16:57] (current) – [laravel.Development] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== php.laravel laravel===== | ===== php.laravel laravel===== | ||
- | <WRAP left tip 60%> | + | * good info start here https:// |
+ | * good site - model info https:// | ||
+ | <WRAP left tip 80%> | ||
php Artisan tinker example user: | php Artisan tinker example user: | ||
<code PHP> | <code PHP> | ||
Line 7: | Line 9: | ||
$methods = (new ReflectionClass(' | $methods = (new ReflectionClass(' | ||
- | $u=User::->find(5); | + | $u=User:: |
show $u # show source | show $u # show source | ||
Line 23: | Line 25: | ||
App\Models\Role:: | App\Models\Role:: | ||
+ | |||
+ | |||
+ | Storage:: | ||
# execute code in tinker from file | # execute code in tinker from file | ||
include('/ | include('/ | ||
+ | |||
+ | ####### - обновление роли | ||
+ | #найти пользователя | ||
+ | User:: | ||
+ | User:: | ||
+ | User:: | ||
+ | User:: | ||
+ | |||
+ | |||
+ | # | ||
+ | User:: | ||
+ | User:: | ||
+ | User:: | ||
+ | |||
+ | |||
+ | function addUser($uid) { | ||
+ | return User:: | ||
+ | } | ||
</ | </ | ||
++++ Get All Models| | ++++ Get All Models| | ||
Line 56: | Line 79: | ||
}; | }; | ||
getAllModels(); | getAllModels(); | ||
+ | |||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | ++++ SQL create php tinker | | ||
+ | 1. format sql | ||
+ | <code SQL> | ||
+ | -- sql for format commands tinker | ||
+ | with q as | ||
+ | (select id, | ||
+ | from public.ad_check | ||
+ | where 1=1 | ||
+ | and ad_status | ||
+ | and ( length(ad_department)> | ||
+ | -- and id in (72, 76, 114, 118, 186, 187, 201, 213, 221, 229, 242, 247, 280, 284, 287, 315, 319) | ||
+ | --and ARRAY_LENGTH(REGEXP_SPLIT_TO_ARRAY(name, | ||
+ | ) | ||
+ | select id, format(' | ||
+ | ,id | ||
+ | , | ||
+ | array[ case when length(ad_department)> | ||
+ | ,case when length(ad_subdepartment)> | ||
+ | ,case when length(ad_position)> | ||
+ | ,'" | ||
+ | ] | ||
+ | ,' | ||
+ | ) | ||
+ | from q; | ||
+ | </ | ||
+ | 2.format php for tinker | ||
+ | <code PHP> | ||
+ | <?php | ||
+ | # execute.php | ||
+ | function updateUser(array &$a ,int $id, array $update = [" | ||
+ | { | ||
+ | | ||
+ | | ||
+ | ," | ||
+ | ," | ||
+ | , | ||
+ | , | ||
+ | ," | ||
+ | ," | ||
+ | ) | ||
+ | ) | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | $data=[]; | ||
+ | |||
+ | updateUser($data, | ||
+ | ," | ||
+ | , " | ||
+ | updateUser($data, | ||
+ | ," | ||
+ | , " | ||
+ | ... | ||
+ | #save result | ||
+ | Storage:: | ||
+ | </ | ||
+ | |||
+ | 3. execute tinker | ||
+ | <code BASH> | ||
+ | >>> | ||
+ | </ | ||
+ | |||
+ | |||
+ | 4. check without role | ||
+ | <code PHP> | ||
+ | |||
+ | |||
+ | $data_u=[]; | ||
+ | |||
+ | $results=User:: | ||
+ | foreach($results as $k => $v) { | ||
+ | if ($v-> | ||
+ | array_push($data_u, | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | Storage:: | ||
+ | |||
+ | |||
</ | </ | ||
Line 67: | Line 174: | ||
==== laravel.Development ==== | ==== laravel.Development ==== | ||
* Laravel' | * Laravel' | ||
+ | * laravel queues https:// | ||
* laracast - namespace https:// | * laracast - namespace https:// | ||
* laravel auth guard https:// | * laravel auth guard https:// |