laravel

Run composer dump-autoload from controller in laravel 5

这一生的挚爱 提交于 2021-01-15 18:39:05
问题 I want to run composer dump-autoload without shell command in controller. In laravel 4 I use Artisan::call('dump-autoload'); but in laravel 5 this command not work. 回答1: Artisan is not wrapper for composer . Composer itself brings the composer command to control itself. Currently there is no way to call composer commands in a proper way from Artisan - not even with creating your own Artisan command with php artisan make:console CommandName . Unless you don't want to use PHPs exec or system ,

Run composer dump-autoload from controller in laravel 5

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-15 18:36:52
问题 I want to run composer dump-autoload without shell command in controller. In laravel 4 I use Artisan::call('dump-autoload'); but in laravel 5 this command not work. 回答1: Artisan is not wrapper for composer . Composer itself brings the composer command to control itself. Currently there is no way to call composer commands in a proper way from Artisan - not even with creating your own Artisan command with php artisan make:console CommandName . Unless you don't want to use PHPs exec or system ,

Install Laravel using Composer

十年热恋 提交于 2021-01-14 09:06:57
问题 I'm trying to install Laravel using Composer , but after running the following command composer create-project laravel/laravel cmsLaravel 5.2 pointing to my c/xampp/htddocs directory, I get the error below: C:\xampp\htdocs\laravelCMS\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravelCMS\bootstrap\autoload.php on line 17 回答1: To install Laravel using composer, all you need to do is to run in your terminal is: composer create-project -

PHP7源码之array_unique函数分析

血红的双手。 提交于 2021-01-13 11:00:26
以下源码基于 PHP 7.3.8 array array_unique ( array array[,intarray[,intsort_flags = SORT_STRING ] ) (PHP 4 >= 4.0.1, PHP 5, PHP 7) array_unique — 移除数组中重复的值 参数说明: array:输入的数组。 sort_flag:(可选)排序类型标记,用于修改排序行为,主要有以下值: SORT_REGULAR - 按照通常方法比较(不修改类型) SORT_NUMERIC - 按照数字形式比较 SORT_STRING - 按照字符串形式比较 SORT_LOCALE_STRING - 根据当前的本地化设置,按照字符串比较。 array_unique 函数的源代码在 /ext/standard/array.c 文件中。由于 PHP_FUNCTION(array_unique){ // code... } 篇幅过长,完整代码不在这里贴出来了,可以参见 GitHub 贴出的源代码。 定义变量 zval *array; uint32_t idx; Bucket *p; struct bucketindex *arTmp, *cmpdata, *lastkept; unsigned int i; zend_long sort_type = PHP_SORT_STRING;

Laravel app stopped working after upgrading to php 8

荒凉一梦 提交于 2021-01-13 09:37:27
问题 after updating my mac to php 8 laravel app stopped working, this is the error I'm getting: Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871 Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945 Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.

“No such file or directory” or “No such host is known” when running migrations

断了今生、忘了曾经 提交于 2021-01-09 12:30:30
问题 I deleted the migrations table from a Laravel 5.4 database named laravel . When I run php artisan migrate:install , I get this error: [Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations) I deleted and recreated the database. I also ran composer update . No luck. I can run the command in phpMyAdmin and create the table manually. This problem sometimes also

“No such file or directory” or “No such host is known” when running migrations

被刻印的时光 ゝ 提交于 2021-01-09 12:30:06
问题 I deleted the migrations table from a Laravel 5.4 database named laravel . When I run php artisan migrate:install , I get this error: [Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations) I deleted and recreated the database. I also ran composer update . No luck. I can run the command in phpMyAdmin and create the table manually. This problem sometimes also

Belongs to relation with a json column in laravel

北战南征 提交于 2021-01-07 07:00:25
问题 This is an awesome package: https://github.com/staudenmeir/eloquent-json-relations But I can't make it work with couple of days struggle. Let me explain my situation and my approach. orders table has json type column named sender_address with the following value: { "title":"office", "street":"Mohakhali Flyover", "lat":"23.7794099", "lng":"90.3983494", "district":"1", "area":"2" } My Order Model Definition: class Order extends Model { use \Staudenmeir\EloquentJsonRelations\HasJsonRelationships

Belongs to relation with a json column in laravel

冷暖自知 提交于 2021-01-07 07:00:18
问题 This is an awesome package: https://github.com/staudenmeir/eloquent-json-relations But I can't make it work with couple of days struggle. Let me explain my situation and my approach. orders table has json type column named sender_address with the following value: { "title":"office", "street":"Mohakhali Flyover", "lat":"23.7794099", "lng":"90.3983494", "district":"1", "area":"2" } My Order Model Definition: class Order extends Model { use \Staudenmeir\EloquentJsonRelations\HasJsonRelationships

Belongs to relation with a json column in laravel

…衆ロ難τιáo~ 提交于 2021-01-07 07:00:05
问题 This is an awesome package: https://github.com/staudenmeir/eloquent-json-relations But I can't make it work with couple of days struggle. Let me explain my situation and my approach. orders table has json type column named sender_address with the following value: { "title":"office", "street":"Mohakhali Flyover", "lat":"23.7794099", "lng":"90.3983494", "district":"1", "area":"2" } My Order Model Definition: class Order extends Model { use \Staudenmeir\EloquentJsonRelations\HasJsonRelationships