Tinker is a REPL for the Laravel PHP framework.
Questions tagged [tinker]
136 questions
1
vote
1 answer
Laravel and Mysql 'has gone away'
I'm trying to set up a new project on MacOS (and it is a first time for me).
After a while I managed to have a MySQL instance that seemed correct (as I could connect both from a client and the command line).
However, if I try to run anything from my…

Ours
- 392
- 6
- 21
1
vote
1 answer
accessing a database field of a many to many relationship through tinker
Couldn't access a database field through tinker
$job::find(2)->despatches->qty
Doesn't work
$job::find(2)->despatches
works
but i need to access the qty field of despatches
Is this possible through tinker?

zaster
- 341
- 3
- 5
- 16
1
vote
3 answers
BadMethodCallException with message 'Method Illuminate\Database\Query\Builder::messages does not exist.'
I am trying to make a chatbox using Laravel and Vue.js. I am following this online tutorial. I have followed almost every step to a tee and I cannot tell why I am not getting the desired result. Here is what I have done thus far:
I have created a…

Toti Cuervo
- 245
- 1
- 8
- 17
1
vote
2 answers
Laravel Tinker shows old values from the collection
I have a Laravel model named Campaigns (made using a jenssegers mongodb extension). When I echo this function:
$campaigns = Campaigns::all();
echo($campaigns);
I get correct values. But whenever I try the same from a Command in a schedule or…

version_control
- 107
- 9
1
vote
1 answer
How to solve namespaces problems in php tinker?
I have the following code:

Popescu Flaviu
- 95
- 2
- 11
1
vote
3 answers
View nested objects under Tinker
On Laravel Tinker when I run this:
>>> $customers = App\Customer::all();
I get a list of objects such as:
=> Illuminate\Database\Eloquent\Collection {#811
all: [
App\Customer {#815
id: 3,
favorite: 6,
user: App\User {#232…

Kal
- 948
- 17
- 30
1
vote
0 answers
laravel5.5 Cache can't get in console or tinker
I use laravel5.5 and on console or tinker use cache object,but i try use cache in console or tinker, is return null!Why? I found just use reids object is ok, but try to exchang cache dirve also wrong!

Y.elinx
- 271
- 3
- 8
1
vote
0 answers
Laravel Tinker: Class 'Psy\Exception\ErrorException' not found
I'm trying to run Laravel 5.5 tinker but get an exception when i try to run the factory Command. For example:
factory(App\Article::class, 100)->create();
When i try to run lets say the User:class command in another repository it works without any…

Stan Barrows
- 873
- 1
- 12
- 27
1
vote
5 answers
PHP Artisan Tinker Cannot Write to Config Path
I have used Tinker before but suddenly it stopped working, no matter what project, what version, new or existing. I am on a macbook pro 2013, mac os Sierra, iterm2 with zsh. I have researched all over and not found anything of relevance with…

Jana
- 29
- 1
- 7
0
votes
1 answer
How to run the php's interactive shell from a php file?
If you run php -a on the cmd it will become the php's interactive shell. How can I do it from a php script? For example, I can run a php script with the line exec('php -S localhost:8080'); in it to start a bult-in server and it will block the…

Bruno Gomes
- 52
- 4
0
votes
0 answers
Running a shell script with a push button using Tinkerboard S GPIO pins
I'm currently trying to figure out how to incorporate a push button into my shell script using the GPIO pins on a tinkerboard S. The purpose of the tinker board is to act as a HDMI video source. I have it running as a video source but need to…
0
votes
1 answer
Laravel - Database connection works on tinker but not website or APIs
I am trying to point a remote database (from another IP) to my laravel setup in AWS EC2 instance. I have added the credentials in env like this (showing random…

user1881473
- 1
- 7
0
votes
0 answers
how to check a mutex exists for a scheduled job using laravel tinker?
I have a job scheduled to run every hour. 'withoutOverlapping' is set for this job and mutex expiry time is 24 hour.
But when I checked cron.log. I found that it is not running every hour. But it runs once in a day and at the end of job, there is a…

xman
- 5
- 7
0
votes
2 answers
Laravel mass update enum column to different value through Tinker
I'm trying to do a mass-update of an enum column's value in my Laravel 9 project through tinker, my model is called Domain and I have an enum column called status with different values.
I'd like to select all entries where status is expired and set…

Ryan H
- 2,620
- 4
- 37
- 109
0
votes
0 answers
What is the `all` property in Laravel collections?
I'm researching Laravel collections and I'm not sure where a property is coming from.
Consider the following command in Laravel Tinker:
>>> collect()
=> Illuminate\Support\Collection {#4103
all: [],
}
What's that all property I'm seeing?…

Marcus McLean
- 1,306
- 2
- 13
- 24