Using Tinker with OctoberCMS - laravel-5

I am new to Laravel and OctoberCMS,
i would like to run tinker, so I navigate to my root directory where my OctoberCMS Instance is and the artisan file is located
I then enter in the Terminal the following command:
php artisan tinker
and i get the following error:
[ErrorException]
The use statement with non-compound name 'BackendAuth' has no effect
Any suggestions to resolve this or tell me what I am doing wrong would be welcome.

It appears that I had a reference where the namespace was not explicit into my routes.php file of a custom plugin.
use BackendAuth;
when I made the reference explicit I was able to get Artisan to work without issue.
use Backend\Facades\BackendAuth;

Do you try to use tinker on clear installation?
In my october, tinker work great.

Related

Please how can I undo ''php artisan livewire:make product-ratings''

After running the command I realized that I don't want to use it again so I deleted the two components it created which are
CLASS: app/Http/Livewire/ProductRatings.php
VIEW: resources/views/livewire/product-ratings.blade.php
Now when I try to access my product in the frontend I get this error
include(C:\xampp\htdocs\keyi\vendor\composer/../../app/Http/Livewire/ProductRatings.php): Failed to open stream: No such file or directory
2 possibilities
You have actually deleted it but it still thinks its there so do php artisan view:clear
or
It seems like you are trying to access a Livewire component that has been deleted, but your application is still trying to include it. This is causing the error message "include(C:\xampp\htdocs\keyi\vendor\composer/../../app/Http/Livewire/ProductRatings.php): Failed to open stream: No such file or directory".
To resolve this issue, you will need to remove any references to the deleted Livewire component from your code. This could include removing references to it in your routes, controllers, views, or other parts of your application.
Once you have removed all references to the deleted component, you should be able to access your product in the frontend without encountering the error message. If you continue to have trouble, you may want to check your logs or run your application in debug mode to get more information about the problem.
Did you try livewire:delete
php artisan livewire:delete product-ratings
and run
php artisan cache:clear
php artisan config:clear
composer dump-autoload # if needed
saw this command in the web livewire:remove.(Not sure if exist)
php artisan livewire:remove product-ratings

Cannot access laravel project via url http://localhost/myproject/public/

When I ran php artisan serve then copy this URL http://127.0.0.1:8000/. Its works. I want to access my project via url http://localhost/myproject/public/.
It returns blank page. And when I inspect the element it returns 500. Internal server error. Appreciate your help regarding this. Thank you.
Laravel version: 5.4
Php Version: 7.1.12
I can access the folders but when accessing the public folder itself. Returns blank page.
When run the php artisan serve. Its working
I found the answer to my question. It's the PHP version. Php7.0 does not support it
You can try doing:
composer install
Or In the root of your project try to run
php -S localhost:8000 -t public/
Check this answer of my prev. question. You should set symbolic link as the docs said.

moving Laravel project between computers

I have been working on a laravel5 project on a computer , but now I want to continue on an other, but don't know how :(
I'm using wampserver and the project is in the "www" folder, this is the error I'm getting when trying to open the project: " Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"
Your error message is very vague, so it is hard to pinpoint the cause. I assume you just copy pasted all of the project files
Try these steps:
Make sure you copy all of the project files including the hidden ones(.env).
Prepare your destination computer as in http://laravel.com/docs/
Check you have all the necessary PHP extensions available in php.ini as in above link requirements. Also, watch your PHP version!
Install composer https://getcomposer.org/doc/00-intro.md
When copied, go to your destination folder and run composer install.
Run php artisan key:generate from the command line.
Run php artisan cache:clear from command line
http://php.net/manual/en/install.windows.commandline.php
Make sure your webserver is serving pages from project/public folder.
If laravel is failing, check the log file to see the cause
your_project/storage/logs/laravel.log
Copy the project folder and navigate terminal/cmd
just run following commands.
Create database and place the same name at .env file in laravel project folder
1. composer install
2. php artisan key:generate
3. php artisan cache:clear
4. php artisan migrate
UPDATE: If you're getting
Whoops, looks like something went wrong
in app/config/app.php, set debugging as true with:
'debug' => env('APP_DEBUG', true)'
If you're getting the error
No supported encrypter found. The cipher and/or key length are invalid
for some people it worked to do cp .env.example .env before (2).
You would also have to create new storage link, because Laravel uses absolute path inside it.
php artisan storage:link
https://stackoverflow.com/a/32722141/3982831 Please follow this to resolve your problems. All people forget about permissions on folders.
After you have done as Ademord answer, you might need to use refresh to your WAMP, XAMP or any other development stack you are using. I had the same issue plus changes were not reflecting in the front end. For example new routes in the web.php were not updating.

php artisan migrate:reset failed to open stream: No such file or directory

when I ran
php artisan migrate:reset
I got
[ErrorException]
include(app/database/migrations/2014_08_06_120900_alter_xxx_table.php): failed to
open stream: No such file or directory
But I don't have that php file, I just have another file named
2014_08_06_121048_alter_xxx_table.php
And the migrations table in mysql has only
2014_08_06_121048_alter_xxx_table.php
but not
2014_08_06_120900_alter_xxx_table.php
Now I can't reset my database. What can I do about this?
First:
composer dump-autoload
Then make de rollback.
This work for me...
composer dump-autoload
php artisan migrate:rollback
php artisan dump-autoload
solve the same problem of mine.. rather than change manually
Deleting the row with 2014_08_06_121048_alter_xxx_table in table migrations didn't really solve the problem. When I run php artisan migrate:reset again, the problem comes again too.
Finally I find the essential reason myself. Due to some reason maybe some wrong commands, wrong filename had been written into
./vendor/composer/autoload_classmap.php
So I correct the filename in this file, everything works well now.
It sounds like you did a migration, then later on deleted a migration file before you did the rollback. So now Laravel is not sure how to rollback your database.
Easiest solution (since you are reseting anyway) is to manually clear all the tables from your database, including the migration table.
Then just run php artisan migrate and it will install the table and run your migrations.
In the future you should not manually alter your migration files unless you have rollbacked first.
Undo the actions the migration done on the database. Then look at the migrations table and remove the row relating to the file you deleted.
After that you might then need to run
composer dump-autoload
This command works
php artisan optimize
php artisan migrate:rollback
Look for the file autoload_classmap.php in /vendor/composer.
Open the file and edit the following:
In return array{ } remove the existing table.php files.
Example:
'CreatePasswordResetsTable' => $baseDir . '/database/migrations/2014_10_12_100000_create_password_resets_table.php',
'CreateUsersTable' => $baseDir . '/database/migrations/2014_10_12_000000_create_users_table.php',
I removed the above two lines from that array and again executed php artisan make:User -m and it created model as well as migration.
This same issue occurred to me while creating a sessions table. Basically it cannot find the path app/database/migrations/2014_08_06_120900_alter_xxx_table.php.
One possibility is that your database/migrations path is not app/database/migrations. So first you should find your correct path for database/migrations. I was using a october cms framework on top of it and found my path was "modules/system/database/migrations".
You need to open the SessionTableCommand.php in vendor/laravel/framework/src/Illuminate/Session/Console path. On the line #77 you will find $path variable. Change that to your path for database/migrations.
In my case line 77 looked like this:
$path = 'modules/system/database/migrations';
These errors happen mostly because of incorrect path for the file or directory.
php artisan dump-autoload
It do well in windows10.
Probably you should manually create folder migrations. Then composer update. And run migrations
Use this command. It worked for me.
php artisan migrate:rollback

Create Controller using artisan - InvalidArgumentException

I am new to laravel.
I have copied command to create controller from a book and I am trying to run that command:
php artisan Usercontroller:make users
I am getting error:
[InvalidArgumentException]
There are no commands defined in the "Usercontroller" namespace.
Did you mean this?
controller
Current working directory is project directory:
C:\wamp\www\laravel>
There is a typo in commmand,
you should use
php artisan controller:make users
Hope this helps.
Command should be
php artisan controller:make users

Resources