I have a project that was created by someone else using Laravel 5.2. I thought I should update this project to at least Laravel 5.3 using the Laravel Guide. When I serve my application it runs correctly but when I try to authenticate myself it gives the error: Call to undefined method Illuminate\Database\Query\Builder::fireCustomModelEvent()
When I discard the changes in the composer.lock file the run composer install, it's fine (obviously does not recognise the Laravel 5.3 changes). This happens when I run composer install.
Try searching your entire project directory for references to fireCustomModelEvent. My suspicion is that you have a library listed in your composer.json file that should have been updated and didn't get updated as part of your migration.
If you have any listings in your vendor folder that turn up results, you will need to update the corresponding package in your composer.json file.
Related
I am upgrading laravel from 5.3 to 5.4. I tried both way, but updating composer or download new laravel 5.4 and paste directory in it.
I am getting error:
In Container.php line 729:
Class hash does not exist
Note: Composer update successfully.
Please us following.
use Illuminate\Support\Facades\Hash;
i hope it helps.
Please use following when error comes same as below picture
Now go to project (root folder) -> storage -> framework
and check that there are views folder exist or not. If there are views folder (C:\xampp\htdocs\project\storage\framework\views) not exist then you should create new folder views and then run your project.
In my case, 3-4 months facing issue and then i saved my project.
I have my laravel project installed using homestead and I connect to it via SSH using Vagrant(on Windows). The first time I launched my project there was a message indicating i have an error in my public/index.php file indicating that directory specified in 'require' on 14 line is not found it was written like this
require __DIR__.'/../vendor/autoload.php';
then I just replaced this line of code with directory of welcome.blade.php file (require .../welcome.blade.php) (the home page of Laravel) and this page displayed each time I went to my project website but there was another message displayed saying
Illuminate\Foundation\Application' not found in
/home/vagrant/code/myProject/bootstrap/app.php on line 14.
I think that is because of the laravel version installed enter image description here
What I find quite suspicious is that I haven't got env file and vendor folder inside my project folder. vendor folder was located in AppData/Roaming/Composer folder by default. I just moved that folder to my project folder
First thing, Revert the changes within public/index.php back to how it was. That deals with autoloading and bootstrapping the laravel application and should never really be changed.
Now ssh to your vagrant box and within the laravel project, run cp .env.example .env and then edit the newly copied .env file to have all your details for DATABASE and APP_NAME.
Next, go into your project, and run composer install and this will install all the needed dependencies from the composer.json file.
And lastly, from within your project, you should now run php artisan key:generate to generate the APP_KEY.
This should fix your issue.
I would also advice that you look carefully over the documentation at https://laravel.com/docs
I am trying to use Xethron/migrations-generator in a Laravel 5.4 project in order to generate migration files for all of the tables in my database. I followed the instructions in the README file for Laravel 5 to the letter. After resolving a complaint or two (had to install php7.0-xml extension), I try to run it but it spits out an error like so:
$ php artisan migrate:generate
Using connection: mysql
Generating migrations for: group_product_assoc, groups, product_hierarchy_assoc, product_product_assoc, products, replist, sessionsOLD, stores, tree, users, zipcode_coordinates
Do you want to log these migrations in the migrations table? [Y/n] :
> n
Setting up Tables and Index Migrations
[Way\Generators\Filesystem\FileNotFound]
/var/www/my-project/vendor/way/generators/src/Way/Generators/templates/migration.txt
I have reported this issue to Xethron on github and apparently I'm not the only person having this problem.
Can anyone tell me how to get this working? I'm not especially fluent with Laravel or Composer so please don't skimp on the basic explanations. I'm using:
Ubuntu 16.04
PHP 7.0.15
Laravel 5.4
I had the same issue. You need to copy the following file to the location:
https://github.com/Xethron/Laravel-4-Generators/tree/master/src/Way/Generators/templates/migration.txt
In to this folder ( it's possible, this does not exist - so you can either create the folders OR change the configuration file (config.php) in vendor Xethron
/var/www/my-project/vendor/way/generators/src/Way/Generators/templates/
J. Doe's answer is essentially correct as far as I can tell. I am posting a more complete solution here to describe the exact steps I took to fix the issue.
Apparently, there's something wrong with the Xethron code in that it tries to refer to a PHP template file that is somehow not properly included/required by the Xethron package. My short-term solution seems to have worked. That solution is to first cd into the working directory:
cd /var/www/my-project
then create the directory where the file should be:
mkdir -p vendor/way/generators/src/Way/Generators/templates
then we put the template file in there in one of two ways. One way, as suggested by J. Doe is to download the file from github (https://raw.githubusercontent.com/Xethron/Laravel-4-Generators/master/src/Way/Generators/templates/migration.txt) and save it as migration.txt in the directory we just created above. Or you can cd into the working directory and execute this command:
curl https://raw.githubusercontent.com/Xethron/Laravel-4-Generators/master/src/Way/Generators/templates/migration.txt > vendor/way/generators/src/Way/Generators/templates/migration.txt
The other way is to copy the template file which is apparently in a subdirectory of the xethron package:
cp vendor/xethron/laravel-4-generators/src/Way/Generators/templates/migration.txt vendor/way/generators/src/Way/Generators/templates/migration.txt
Once the file exists in that location, You should be able to run the command again without a hitch:
php artisan migrate:generate
This issue has been resolved, simply run composer update to get the latest version.
Apologies for the inconvenience.
I'm trying to set up an existing site that was built using Laravel 4 on my server. I've gotten stuck at an error: Driver [file] not supported. It's throwing the error from Illuminate/Support/Manager.php.
I've tried using boilerplate Laravel files for the Manager.php file, as well as the SessionManager.php file, but it still won't work. I've also tried to figure out if file is registered as a driver, but when I try to insert the code for it, I get lost because of undeclared functions.
When I try to change the default session driver in app/config/session to anything else, it just throws other errors at me. Yet this is the same way the site was originally set up on its own server, so I don't understand why it isn't working. Can anyone help me out?
I was stuck in same problem, solved it. After changing any configuration config cache must be cleared using php artisan config:cache. Hope it helps.
What is your php version?
Try to clean the session dir
app/storage/sessions
then try to clean autoload file
cd [YOUR LARAVEL ROOT DIR]
composer dump-autoload
and update composer package to be sure vendor folder is ok
cd [YOUR LARAVEL ROOT DIR]
composer update
The Yii2 preview was recently released and is available on github. I want to take it for a test drive, but the "documentation" so far gets outdated almost instantly since it is still under heavy development. I have tried to follow this guide on creating a simple CRUD app with Yii2, but it fails at the step:
php yiic.php app/create /var/www/yii2
With the error:
Could not open input file: yiic.php
Indicating that there is no file called yiic.php. The only folder within the framework folder is yii (framework/yii), and within that folder there is no file yiic.php, only Yii.php which when called in the command line gives the command list:
The following commands are available:
- asset
- cache
- help
- message
- migrate
Anyone managed to successfully setup a Yii2 app? Care to share how you got it done?
Seems like yiic has been removed for now, there are alternatives though, so read on.
It's all in the early stages, so the following method could break in the coming days/weeks/months. Therefore use with caution.
There are 2 ways to do this now:
Use composer. (I recommend this option.)
Directly copy the contents of yii2/apps/ directory to your apps directory, depending on the type of app you want to try.
There are currently 2 options for type of app - advanced, and basic. Both are in their respective directories within the yii2/apps/ directory, i.e yii2/apps/advanced and yii2/apps/basic.
For basic go through the basic readme.md, and for advanced go through the advanced readme.md.
The directions for using composer are given in the respective readme.md files. Including them here for completeness:
Basic app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-basic my_yii2_trial
Access app from http://localhost/my_yii2_trial/www
Advanced app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-advanced my_yii2_trial
According to readme, after step 2 app should be accessible, but composer was failing(see issue 439). With schmunk's tip, ran the install or install.bat command that gets copied by composer: ./install . Selected development environment (by entering choice 0 in the instructions that show up when running install command). Update: The command has been renamed to init, composer doesn't fail anymore, with fix from Qiang (check the issue 439 for more details).
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Here's how to copy the directory and get it working:
Basic app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/basic/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/www/index.php file to point to the correct path for Yii.php.
For me it was within yii2/framework/yii/
comment the line that tries to include ../vendor/autoload.php file, I couldn't find that file anywhere, so its probably for some future use. it is the autoloader provided by composer.
Access from browser : http://localhost/my_yii2_trial/www
Advanced app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/advanced/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/frontend/www/index.php file to point to the correct path for Yii.php. Similarly modify backstage/www/index.php.
comment the line that tries to include ../vendor/autoload.php file in both the index.php of backstage and frontend.
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Some important links to read more about this: issue 77, issue 108, issue 131, and wiki comment.
I am not sure how composer's autoloader is being used, so can't comment on that. Also in future versions, backstage might be renamed to backend.