Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
devweb:laravel:upgrade [15-04-2021 10:05] edmc73 |
devweb:laravel:upgrade [26-08-2023 23:58] (Version actuelle) edmc73 |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Upgrade ====== | ====== Upgrade ====== | ||
- | ===== Sur changement | + | ===== passer |
- | Concerne Laravel 5.3 | + | Créons une nouvelle branch dans notre projet |
+ | git checkout -b laravel-upgrade | ||
+ | |||
+ | Ajouter le dépôt de laravel | ||
+ | git remote add laravel https:// | ||
- | ErrorException in Builder.php line 876: | + | Récupérer les informations du dépôt |
- | | + | |
- | vi vendor/laravel/framework/ | + | Merger la version 8.x |
- | | + | git merge laravel/8.x |
+ | | ||
- | cherche | + | git merge --no-commit |
- | <code php> | + | |
- | | + | |
- | | + | |
- | | + | |
- | 875 | + | |
- | | + | |
- | 877 | + | |
- | | + | |
- | 879 | + | |
- | | + | |
- | | + | |
- | </ | + | |
- | et remplace | + | |
- | <code php> | + | |
- | | + | |
- | | + | |
- | | + | |
- | 875 | + | |
- | | + | |
- | 877 | + | |
- | | + | |
- | 879 | + | |
- | | + | |
- | | + | |
- | </code> | + | |
+ | Valider tous les conflits avec l' | ||
- | ErrorException in Builder.php line 771: | + | Si vous avez bien mis à jour le composer.json, lancer un composer update |
- | | + | |
- | vi vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php | + | Si certaine version dans le composer.json ne sont plus compatible, supprimer la ligne dans le composer et lancer la commande suivante sans spécifier la version |
- | | + | composer require |
+ | composer require yajra/laravel-datatables | ||
+ | |||
+ | |||
+ | ATTENTION: avec cette méthode, j'ai l' | ||
+ | |||
+ | Donc, une fois que toutes les modifs sont faites, Copier/coller tous vos fichiers dans une nouvelle branche de votre projet tout propre (en excluant le dossier .git) | ||
+ | |||
+ | <code bash> | ||
+ | # se mettre dans votre projet laravel 6 propre | ||
+ | git checkout -b laravel8 | ||
+ | |||
+ | # copier tous les fichiers de votre projet upgradé sur la nouvelle branche de votre projet actuel | ||
+ | rsync -a --exclude ' | ||
+ | |||
+ | # pouvez maintenant faire un commit de toutes les modifs de votre projet | ||
+ | |||
+ | # il se peut que le dossier vendor soit tout pourri | ||
+ | rm -fr vendor | ||
+ | composer install | ||
- | cherche | ||
- | <code php> | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | 773 | ||
- | | ||
- | 775 | ||
- | | ||
- | | ||
- | 778 | ||
- | | ||
- | | ||
- | </ | ||
- | et remplace | ||
- | <code php> | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | 773 | ||
- | | ||
- | 775 | ||
- | | ||
- | | ||
- | 778 | ||
- | | ||
- | | ||
</ | </ | ||
- | ErrorException in Builder.php line 1231: | + | Penser à mettre à jour nodejs et npm |
- | count(): Parameter must be an array or an object that implements Countable | + | |
+ | |||
+ | ===== passer de laravel 6 à 8 (alternative) ====== | ||
+ | |||
+ | Même manip qu'au dessus mais en utilisant l' | ||
+ | |||
+ | |||
+ | ===== bdd ===== | ||
+ | |||
+ | Quelques modifs à noter | ||
+ | < | ||
+ | // La table user, ajouter un champ | ||
+ | |||
+ | $table-> | ||
+ | |||
+ | // la table password_resets, | ||
+ | |||
+ | // voir aussi la table failed-job | ||
- | vi vendor/ | ||
- | ligne: 1231 | ||
- | cherche | ||
- | <code php> | ||
- | 1222 | ||
- | 1223 { | ||
- | 1224 | ||
- | 1225 | ||
- | 1226 | ||
- | 1227 | ||
- | 1228 // We will keep track of how many wheres are on the query before running the | ||
- | 1229 // scope so that we can properly group the added scope constraints in the | ||
- | 1230 // query as their own isolated nested where statement and avoid issues. | ||
- | 1231 | ||
- | 1232 | ||
- | 1233 | ||
- | 1234 | ||
- | 1235 if ($this-> | ||
- | 1236 | ||
- | 1237 } | ||
- | 1238 | ||
- | 1239 | ||
- | 1240 } | ||
- | </ | ||
- | et remplace | ||
- | <code php> | ||
- | 1222 | ||
- | 1223 { | ||
- | 1224 | ||
- | 1225 | ||
- | 1226 | ||
- | 1227 | ||
- | 1228 // We will keep track of how many wheres are on the query before running the | ||
- | 1229 // scope so that we can properly group the added scope constraints in the | ||
- | 1230 // query as their own isolated nested where statement and avoid issues. | ||
- | 1231 | ||
- | 1232 | ||
- | 1233 | ||
- | 1234 | ||
- | 1235 if ($this-> | ||
- | 1236 | ||
- | 1237 } | ||
- | 1238 | ||
- | 1239 | ||
- | 1240 } | ||
</ | </ | ||
+ | ===== Voir les modifs faites entre 2 versions de laravel ===== | ||
- | ErrorException in Collection.php line 1099: | + | Exemple des fichiers modifiés entre la version 6.x et 8.x de laravel |
- | A non-numeric value encountered | + | |
- | vi vendor/laravel/framework/src/Illuminate/Support/Collection.php | + | https:// |
- | ligne: 1099 | + | |
+ | ===== Passer de gulp à laravel-mix ===== | ||
+ | |||
+ | combiner du less avec du css. L' | ||
+ | < | ||
+ | mix.less(' | ||
+ | .options({ | ||
+ | processCssUrls: false | ||
+ | }); | ||
+ | |||
+ | mix.styles([ | ||
+ | ' | ||
+ | ' | ||
+ | ], ' | ||
- | cherche | ||
- | <code php> | ||
- | 1090 | ||
- | 1091 { | ||
- | 1092 if (is_null($callback)) { | ||
- | 1093 | ||
- | 1094 } | ||
- | 1095 | ||
- | 1096 | ||
- | 1097 | ||
- | 1098 | ||
- | 1099 | ||
- | 1100 }, 0); | ||
- | 1101 } | ||
</ | </ | ||
- | remplace | + | |
- | < | + | combiner les js |
- | 1090 | + | < |
- | 1091 { | + | mix.scripts([ |
- | 1092 if (is_null($callback)) { | + | ' |
- | 1093 | + | ' |
- | 1094 } | + | ], ' |
- | 1095 | + | |
- | 1096 | + | |
- | 1097 | + | |
- | 1098 | + | |
- | 1099 | + | |
- | 1100 }, 0); | + | |
- | 1101 } | + | |
</ | </ | ||
- | ErrorException in Validator.php line 1603: | + | Puis versionner le tout |
- | | + | < |
- | + | mix.version([ | |
- | vi vendor/laravel/framework/src/Illuminate/ | + | ' |
- | | + | ' |
+ | ],' | ||
+ | </ | ||
- | chercher | + | Utiliser maintenant le helper mix() à la place de elixir() |
- | <code php> | + | |
- | protected function validateUrl($attribute, $value) | + | |
- | { | + | |
- | /* | + | |
- | * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator | + | |
- | * | + | |
- | * (c) Fabien Potencier < | + | |
- | */ | + | |
- | $pattern = '~^ | + | |
- | ((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-playcontainer|dlna-playsingle|dns|dntp|dtn|dvb|ed2k|example|facetime|fax|feed|feedready|file|filesystem|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|ham|hcp|http|https|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|ms-help|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|msnim|msrp|msrps|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|oid|opaquelocktoken|pack|palm|paparazzi|pkcs11|platform|pop|pres|prospero|proxy|psyc|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|secondlife|service|session|sftp|sgn|shttp|sieve|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|turn|turns|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|videotex|view-source|wais|webcal|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s)):// | + | |
- | (([\pL\pN-]+: | + | |
- | ( | + | |
- | ([\pL\pN\pS-\.])+(\.? | + | |
- | | # or | + | |
- | \d{1, | + | |
- | | # or | + | |
- | \[ | + | |
- | (?: |