Browse AI Field GuideForum Podcast
All ThreadsLeaderboard
  1. Discussions

    1. Popular This Week
    2. Popular All Time
    3. Solved
    4. Unsolved
    5. No Replies Yet

lara65535's avatar

DB Not Persisting Through UnitTests

My testing, in memory, sqlite database is not persisting through model calls... The code is the following... public function setUp() { parent::setUp(); dd(DB::connection()->getName(), User::all()->first()->getConnectionName()); } and the result is ... testing mysql Why is the database being reset through the model calls

lara65535's avatar
lara65535's avatar gofish5438yrs agoTesting
2
1
Last reply by gofish543 8yrs ago
makapaka's avatar

assertDatabaseHas does not exist?

Just following some Jeffrey's testing methods, in my feature test case I have assertDatabaseHas, but getting error BadMethodCallException: Method assertDatabaseHas does not exist. Am i missing a dependancy or something ? Again as per Jeffrey's methods, I'm using sqlite for the testing. I'm using the DatabaseMigrations trait and the test extends TestCase as expected, what could

makapaka's avatar
makapaka's avatar makapaka8yrs agoTesting
1
1
Last reply by makapaka 8yrs ago
apecengo's avatar

Problems with in-memory database testing and RefreshDatabase trait

I'm having a bit of a problem when testing with the in-memory database and the RefreshDatabase trait. It seems that the database is not being refreshed after each test. <?php namespace Tests\Unit\User; use App\Name; use App\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; class AttributesTest extends TestCase { use RefreshDatabase; pub

apecengo's avatar
apecengo's avatar apecengo8yrs agoTesting
0
1
ahmadissa's avatar

Phpunit drops database tables

I'm trying to test my app using phpunit with laravel but each time I run unit test vendor\bin\phpunit All tables in my database drop so I have to migrate each time I run a test I tried mysql and sqlite and same issue main database on mysql and test on sqlite Have you encountered with similar issue & how can I fix it ?

ahmadissa's avatar
ahmadissa's avatar zhaozhenxi...10mos agoLaravel
6
1
Last reply by zhaozhenxiang 10mos ago
makapaka's avatar

Testing endpoint with Passport client credentials

My POST endpoints use the ->middleware('client') via Passport. So in reality, my clients have a client_secret, send that through to /oauth/token and get a token back that they can use in subsequent POST requests. Question is, how do you do this inside phpunit test cases if, following Jeffrey's testing we use the :memory: DB with sqlite ? How do I get a client_secret generate

makapaka's avatar
makapaka's avatar makapaka8yrs agoLaravel
1
1
Last reply by makapaka 8yrs ago
makapaka's avatar

testing memory size

As per Jeffrey's forum workflow, I am building some tests to run on my Laravel API, and following his steps, i'm using the :memory: sqlite feature in phpunit. On the very first test that is failing, I thought I would var_dump the $response, so that I can see what is happening, and on the var_dump line itself, i'm getting the error: [Symfony\Component\Debug\Exception\FatalErro

makapaka's avatar
makapaka's avatar makapaka8yrs agoLaravel
1
1
Last reply by makapaka 8yrs ago
PaulClarke's avatar

Null object in test using Eloquent

So I am attempting to test that when a user has forgotten their password, they can enter their email address and receive a password reset email. The code works, but the test fails. (I have made a create helper method like JW had on the 'How to Build a Forum' series). /** @test */ public function a_user_can_request_an_email_to_reset_their_password() { Notificati

PaulClarke's avatar
PaulClarke's avatar PaulClarke8yrs agoTesting
3
1
Last reply by PaulClarke 8yrs ago
harishkumar's avatar

Laravel gate error, no such table: permissions (SQL: select * from “permissions”)

For laravel testing environment, Laravel gate is not working. In phpunit.xml file, I am using sqlite connection and :memory: as database. <env name="DB_CONNECTION" value="sqlite"/> <env name="DB_DATABASE" value=":memory:"/> In AuthServiceProvider, I am defining gate as in this code below. public function boot(GateContract $g

harishkumar's avatar
harishkumar's avatar harishkuma...8yrs agoLaravel
2
1
Last reply by harishkumar 8yrs ago
thc1967's avatar

Migrate & Seed Only Once?

I've finally bumped into a spot in my project that I can no longer use an in-memory sqlite database for my unit tests. It was cool while it lasted but, alas, I need to do some stuff that sqlite simply doesn't support. And I want to keep using unit testing. I'm pretty stoked that I have hundreds of tests with thousands of assertions. I've found it helps tremendously with everyth

thc1967's avatar
thc1967's avatar thc19678yrs agoTesting
9
1
Last reply by thc1967 8yrs ago
davedriesmans's avatar

.env.testing not loaded

I want to use two connections: mysql for local dev, sqlite for testing. I configured this in .env and .env.testing The issue is that it always takes the connection of the .env file Any ideas where i can look? php artisan migrate --env=testing gives [PDOException] SQLSTATE[HY000] [2002] Connection refused phpunit.xml <?xml version="1.0" encoding="UTF-8"?&

davedriesmans's avatar
davedriesmans's avatar ejdelmonic...8yrs agoTesting
5
1
Last reply by ejdelmonico 8yrs ago
rcadhikari's avatar

PHPUnit fails to count with group by on query to the database view (not table)

Laravel Version: 5.4.* PHP Version: >=5.6.4 Database Driver & Version: MySQL (Testing with SqlLite) Description: I have an Eloquent model called ProductStatistics with $table='view_products', here view_products is a database view rather than table. view_products has following: | product_id | product_name | category_id | category_name | | ------------- |:-------------:|

rcadhikari's avatar
rcadhikari's avatar rcadhikari8yrs agoTesting
0
1
s24WebDev's avatar

Delaying Jobs

Hey guys i want to delaying a job within my Controller. I migrated the jobs table on my sqlite connection and configured the queue driver to database. But no job was stored in the database. what am i doing wrong? env DB_CONNECTION=sqlite QUEUE_DRIVER=database queue conf 'database' => [ 'driver' => 'database', 'connection' => 'sqlite',

s24WebDev's avatar
s24WebDev's avatar webcodecs8yrs agoLaravel
14
1
Last reply by webcodecs 8yrs ago
ohffs's avatar

Dusk tests on upgraded L5.5 app report readonly database

I've been stuck on this for a while so finally giving in and asking... I've updated an app from 5.4 -> 5.5 and all is good. Reguar phpunit tests all pass. But the dusk tests fail whenever I'm using the database migrations trait with : PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database I've got dusk 2.x, pulled in the current dusk test case

ohffs's avatar
ohffs's avatar acacha8yrs agoLaravel
2
1
Last reply by acacha 8yrs ago
archiebango's avatar

I got suggestions and errors in Terminal after creating new project in Laravel

I got errors and suggestions in terminal after creating a new project, I also did the global composer update but after loading the page, I got "Whoops, looks like something went wrong." any help please? thanks symfony/var-dumper suggests installing ext-symfony_debug () symfony/routing suggests installing doctrine/annotations (For using the annotation loader) symfony/r

archiebango's avatar
archiebango's avatar archiebang...8yrs agoLaravel
5
1
Last reply by archiebango 8yrs ago
phpMick's avatar

An error occurred while connecting to the database ':memory:'

I get this error when trying to execute my tests: PHPUnit 5.7.13 by Sebastian Bergmann and contributors. E{"sError":"An error occurred while connecting to the database ':memory:'. The error reported by the server was: SQLSTATE[HY000] [1044] Access denied for user 'mick'@'%' to database ':memory:'"} phpUnit.xml <php> <env name="APP_E

phpMick's avatar
phpMick's avatar phpMick8yrs agoGeneral
2
1
Last reply by phpMick 8yrs ago
eugenefvdm's avatar

Permissions table referred to in AuthServiceProvider fails to migrate during PHPUnit test

When I run vendor/bin/phpunit against a simple test I get: There was 1 error: 1) Tests\Feature\CommissionsTest::when_adding_a_subscription_also_assign_commission Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: permissions (SQL: select * from "permissions") I'm using an in-memory SQLite database. In AuthServiceProvider.php when I

eugenefvdm's avatar
eugenefvdm's avatar HenriqueTe...7yrs agoTesting
1
1
Last reply by HenriqueTeixeira 7yrs ago
Kenneth_H's avatar

UnitTest/FeatureTest result differs from actual result from the browser

Hi I am currently coding an ecommerce project using TDD and have come to the point where I want to make sure that if a user for some reason bypasses the builtin browser validation to not add a negative quantity to the shopping cart. The way this is done is by having the Cartitem model implement a check in the save method. This checks if the quantity field is less than zero and

Kenneth_H's avatar
Kenneth_H's avatar Kenneth_H8yrs agoTesting
0
1
mushood's avatar

Database connection and transactions

Hello I am running phpunit test on my project and I have two issues: I can't seem to get DatabaseTransactions to work. Data is persisted and not rolled back. Test passes. I can't change the default database connection to another specific database. Here are the relevant files: My test file: <?php namespace Tests\Unit; use Tests\TestCase; use Illuminate\Foundation\Testin

mushood's avatar
mushood's avatar mushood8yrs agoTesting
2
1
Last reply by mushood 8yrs ago
shaikh709's avatar

ActingAs Not working.

I'm trying to test if user can see dashboard after login however it works perfectly fine in browser but when I run phpunit. I get status code 302. It redirect to login page. I'm using sqlite for testing <php> <env name="APP_ENV" value="testing"/> <env name="DB_CONNECTION" value="sqlite" /> <

shaikh709's avatar
shaikh709's avatar shaikh7099yrs agoGuides
1
1
Last reply by shaikh709 9yrs ago
jgravois's avatar

Laravel 5.4 Testing Using Transactions -- Wrong Database

We have far too many migrations to use database migrations (because they really slow the testing down and then the developers don't test), so I am trying to move to use database transactions meaning moving from sqlite in :memory: to a sibling mysql database. However using the setup below, I am pulling from our production database rather than the new testing database. #config/da

jgravois's avatar
jgravois's avatar nbennett458yrs agoTesting
2
1
Last reply by nbennett45 8yrs ago
aeltaib's avatar

Laravel suggestions when create a new project (Ubuntu)

Installing laravel/laravel (v5.4.23) Installing laravel/laravel (v5.4.23) Downloading: 100% Created project in associations php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies (including require-dev) Installing symfony/css-selector (v3.3.0) Downloading: 100% Installing tijsv

aeltaib's avatar
aeltaib's avatar MaverickCh...9yrs agoLaravel
1
1
Last reply by MaverickChan 9yrs ago
skinnyvin's avatar

Migrations not peristing

I am following the TDD Forum series and I think I must've missed something configuration wise. If I run : php artisan migrate My tables migrate, but they do not persist. Soon after the tables are deleted. My .envs pecifies mysql. Should I have config somewhere for the tests to use an sqlite db? Not sure what I have missed. THanks

skinnyvin's avatar
skinnyvin's avatar skinnyvin9yrs agoLaravel
7
1
Last reply by skinnyvin 9yrs ago
devonblzx's avatar

DatabaseMigrations has stopped working all of a sudden

All of a sudden our tests started failing today, but yesterday were working fine. Pretty much all of them were reporting that the users table does not exist. I have narrowed it down to the migrations not being run before the test cases start even though all of the classes are using the DatabaseMigrations trait. The odd thing is migrate:rollback seems to work since changing it

devonblzx's avatar
devonblzx's avatar kylevorste...9yrs agoTesting
1
1
Last reply by kylevorster 9yrs ago
sherwinmdev's avatar

ideas to store record activity logs?

i need to store data whenever a record is created, updated, deleted. my migration file is as follows Schema::create('record_logs', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('user_id') ->index() ->unsigned(); $table->string('user_full_name'); $table->

sherwinmdev's avatar
sherwinmdev's avatar HRcc9yrs agoLaravel
5
1
Last reply by HRcc 9yrs ago
thomthom's avatar

DatabaseMigrations vs DatabaseTransactions

I have been using DatabaseMigrations with a in memory sqlite db for my tests on this project of mine. However, I need to switch to MySQL as I need some SQL features that sqlite doesn't support. With MySQL, is it better to use DatabaseTransaction? (Get the impression of migrations with MySQL is heavier than sqlite...)

thomthom's avatar
thomthom's avatar cameronwil...6yrs agoTesting
4
1
Last reply by cameronwilby 6yrs ago
projectmentor's avatar

How to determine current database driver

Hi guys, What is the best way to determine the current database driver? Currently using this code in Laravel 5.2: switch(DB::connection()->getPDO()->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'mysql': //mysql syntax break; case 'sqlite': //sqlite syntax break; default: throw new \Exception('Driver no

projectmentor's avatar
projectmentor's avatar damienlaba...1yr agoLaravel
6
1
Last reply by damienlabat 1yr ago
Mfrancik's avatar

database migration issues

I have been using sqlite for development since I started my project and attempted to change everything to mysql with no avail. I am trying to build database in sqlite to continue dev but when running the php artisan migrate command I get: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1 no such table: accounts (SQL: select * fr om "accounts" lim

Mfrancik's avatar
Mfrancik's avatar Mfrancik9yrs agoLaravel
16
4
Last reply by Mfrancik 9yrs ago
niceseb's avatar

QueryException in Connection.php line 647: Database (/database/database.sqlite) does not exist. (SQL: select * from "products"

Now that I have removed database(and all subfolders seeds/migrations/factories) completely by mistake. How to revert back to refresh installed status as php artisan migrate no longer works... I tried to manually add back those folders and files from another project but does not work anymore? EDIT: Solved, i just need to find out why after adding items in sqlite, broswer shows Q

niceseb's avatar
niceseb's avatar tykus9yrs agoLaravel
9
1
Last reply by tykus 9yrs ago
Muhammad.shahid.shah's avatar

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. (SQL: select * from `threads` order by `created_at` desc)

1)i am watching the create a forum series and in lesson 2 i am stuck in testing, there if you watch jeff uses sqlite for testing purpose i did same but i am getting above error.i tried changing 127.0.0.1 to localhost and clearing cache, config etc but not working here is my .evn APP_NAME=Laravel APP_ENV=local APP_KEY=base64:h90atKo/VaDe9Cgh0dXHrB5kpkq4uGqXcVflJJ6jfAw= APP_DEBUG

Muhammad.shahid.shah's avatar
Muhammad.shahid.shah's avatar alirez5yrs agoGeneral
8
2
Last reply by alirez 5yrs ago
thelazzyriveryogi's avatar

Phpunit errors

I had finally got phpunit working and running a few tests... But I moved an objects creation to the setup and bam got errors. Since then I have cascaded down to a bin of pain. Originally when I moved my objects creation to the setup method I got class hash not found. I tinkered around and got undefined index. I ran cache:config I believe when everything seemed to get hopeless.

thelazzyriveryogi's avatar
thelazzyriveryogi's avatar thelazzyri...9yrs agoLaravel
2
1
Last reply by thelazzyriveryogi 9yrs ago
thelazzyriveryogi's avatar

Testing Database 5.4

I've been trying for a little while now to set up a testing database in laravel 5.4 If there are any up to date resources on doing this I would like to see it. I am wondering if a lot of the resources I have tried are obsolete. Firstly, I am correct that once I setup the sqlite database for testing I do need to run migrations? Because thats when I am hitting my errors. As long

thelazzyriveryogi's avatar
thelazzyriveryogi's avatar thelazzyri...9yrs agoLaravel
10
1
Last reply by thelazzyriveryogi 9yrs ago
TheFriendlyHacker's avatar

Where to store a lot of static data?

Short background: I am working with a client who organizes lectures/conferences for audiences. The site I am building will be responsible for displaying information about these conferences as well as selling tickets for them. TL;DR I have a lot of semi-static data that needs to be displayed on a site (I say "semi-static" because it does not dynamically change based on

TheFriendlyHacker's avatar
TheFriendlyHacker's avatar andonovn9yrs agoLaravel
3
1
Last reply by andonovn 9yrs ago
justincdotme's avatar

Test Database for Laravel Dusk (5.4)

I am trying to set up Dusk to use a specific SQLite DB for testing but I cannot get Dusk to use the values in my Dusk specific .env file(s). I created .env.dusk.local and .env.dusk.testing (I know that I only actually need 1 of the .env.dusk.* files but I am using both just to try to get the darn thing working) and set DB_CONNECTION=sqlite in both of those env's. I even tried a

justincdotme's avatar
justincdotme's avatar gedanken3yrs agoTesting
12
1
Last reply by gedanken 3yrs ago
alhoqbani's avatar

Changing default disk for testing.

I'm trying to build a test for images handling in my application. For the database testing I'm using DatabaseMigrations, so the test persists records in sqlite memory and then discard them after the test. Is there a way to achieve equivalent results when testing file handling (uploading and deleting files). Right now I'm using the fake method as suggested per the docs:

alhoqbani's avatar
alhoqbani's avatar marcusmyer...6yrs agoTesting
4
1
Last reply by marcusmyers 6yrs ago
tanmay_das's avatar

QueryException in Connection.php line 647: Database (database/database.sqlite) does not exist.

I have been following along the Laravel 5 from scratch tutorial series and I am now stuck at lecture 7 which is about the DB migration. I was able to create table and insert rows into it from the tinker but when I try to query the db from controller I get the above-mentioned error. Here is my .env file: APP_ENV=local APP_KEY=base64:nvSV7OF0nXn+KTsVRypOReXNSruqXb0pzBEFB/6vENw= A

tanmay_das's avatar
tanmay_das's avatar tanmay_das9yrs agoLaravel
1
1
Last reply by tanmay_das 9yrs ago
aahoora's avatar

Error during refresh tables

I use SQLITE and wanted to create my own users table so I removed predefined table and migration users using command: Schema::drop('users'); after recreating table users, when I tried to refresh my tables by command: php artisan migrate:refresh I faced error: [ErrorException] Undefined index: 2014_10_12_100000_create_password

aahoora's avatar
aahoora's avatar davidpiess...9yrs agoLaravel
6
1
Last reply by davidpiesse 9yrs ago
slewis's avatar

Laravel extend Validator to account for different schemas/connections

Hi, Currently we are using the Laravel's form request validation to verify that a user's email is unique to the users table: 'email' => 'required|email|unique:pgsql.schema.users' We are using postgres and in order to connect to the appropriate schema we need to define the connection name as follows in the unique rule: unique:[connection].[schema].[table] We cannot leave out

slewis's avatar
slewis's avatar slewis9yrs agoLaravel
2
1
Last reply by slewis 9yrs ago
aahoora's avatar

Database (database/database.sqlite) does not exist" error on running

Hi I've created an sqlite database using command php artisan make:migration create_cards_table --create=cards and php artisan migrate All things was well and I inserted data in my database successfully. but when I run my code to fetch data from database I faced with this error: Database (database/database.sqlite) does not exist. (SQL: select * from "cards") Here

aahoora's avatar
aahoora's avatar vrkansagar...6yrs agoGeneral
18
25
Last reply by vrkansagara 6yrs ago
MacieG's avatar

[PDOException] could not find driver - Laravel - WAMP

Hi i want to migrate from sqlite to mysql, i install WAMP server, configure this and work fine, but... [PDOException] could not find driver i see this error when i want php artisan migrate Select PHP: 5.6.25, but on 7.0.10 dont work too my php.ini from wamp ;extension=php_pdo_firebird.dll extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_odbc.dll ex

MacieG's avatar
MacieG's avatar karan_5.48yrs agoLaravel
4
1
Last reply by karan_5.4 8yrs ago
stwilson's avatar

DB updateOrInsert , upon reaching index constraint won't update

Using Laravel 5.4, I'm having a problem with updateOrInsert error when it encounters a unique index constraint with duplicate data. I'm working through a Laracast lesson Incremental APIs: Level 5: Seeders Reloaded. Using MySQL the loop, shown below, executes until it encounters the unique index constraint on the pivot table, lesson_tag: $lessonIds = Lesson::pluck('id')->toA

stwilson's avatar
stwilson's avatar stwilson9yrs agoLaravel
0
1
GreyhoundIT's avatar

If form feild is blank insert a 0

Looking for somehelp. Locally on sqlite my app works but ater deploying to heroku on a postgres database I was getting some invalid input syntax for integer: "" errors. I have set the feilds to nullable in the migration eg. $table->integer('g1_handicap')->unsigned()->nullable(); In my form i am submitting I have 8 of these fields that are integer's . I was e

GreyhoundIT's avatar
GreyhoundIT's avatar kieranjfah...9yrs agoLaravel
2
1
Last reply by kieranjfahy 9yrs ago
bigboss's avatar

issue with boolean field when migrating with mysql

I'm having a issue with boolean fields with mysql, I've a migration set like this Schema::create('clients', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('phone'); $table->boolean('has_whatsapp')->default(0); $table->timestamps(); }); S

bigboss's avatar
bigboss's avatar luchmewep6yrs agoLaravel
7
1
Last reply by luchmewep 6yrs ago
sebastiansulinski's avatar

Dusk database migrations with .env.dusk.local and Homestead

I'd really want to make use of Dusk, but after spending hours I'm still without any luck setting it up to make it work with database. I've added .env.dusk.local and tried sqlite with :memory: and with the actual database file. I also tried mysql with homestead, which is what I use for my local environment using database created specifically for tests with host 127.0.0.1 and por

sebastiansulinski's avatar
sebastiansulinski's avatar tpraxl9yrs agoTesting
5
1
Last reply by tpraxl 9yrs ago
foae's avatar

Eloquent update ignores setXAttribute

Hello, I've came across a weird behaviour with Eloquent. I'm inserting data the usual way, Model::create([array with data and a timestamp]); which comes from an API. Afterwards, I'm periodically checking if the timestamp has changed local -vs- remote. If there are remote differences, I'll simply pull again the whole result and update the rows running HetrixResult::where('restri

foae's avatar
foae's avatar foae9yrs agoEloquent
2
1
Last reply by foae 9yrs ago
kaysus's avatar

Call to undefined function Yajra\Pdo\oci_connect( )

Hi, i have already this error :( [Symfony\Component\Debug\Exception\FatalErrorException] Call to undefined function Yajra\Pdo\oci_connect( ) my oracle.php file: #<?php return [ 'oracle' => [ 'driver' => 'oracle', 'tns' => env('DB_TNS', 'salima'), 'host' => env('DB_HOST', '172.16.0.16'), 'port' => env('DB_PORT', '1521'), 'database' => env('DB_DATABASE', 'sal

kaysus's avatar
kaysus's avatar gbryant2006yrs agoLaravel
1
1
Last reply by gbryant200 6yrs ago
canadianlover's avatar

Unsupported driver [redis]

I have a Redis database almost set up correctly on my server. I figured out that my redis connection has to be in my connections array in my copnfig/database.php file. after running this configuration, with the driver set to 'redis' in my configuration,i get the following error message: Unsupported driver [redis] I tried just the redis configuration at the bottom of the config/

canadianlover's avatar
canadianlover's avatar rhand7yrs agoLaravel
5
1
Last reply by rhand 7yrs ago
kaypro4's avatar

Way to "collapse" migrations?

Hello, I'm using SQLite to run unit tests in a docker container in GitLab and am unable to use the 5.2 migrations to create the schema fresh before population because alter statements aren't supported in SQLite and our migrations contain some. It seems like there should be a way to "collapse" the migrations to a final result that would just be single create statements

kaypro4's avatar
kaypro4's avatar kaypro49yrs agoTesting
2
1
Last reply by kaypro4 9yrs ago
anon40457's avatar

Order by the difference of two columns in Laravel 5.3

I have an eloquent query where one of the orderBy is the difference of two columns. $mymodel = Level::where([['ColA', 5], ['ColB', 10], ['ColC', 7]]) ->orderBy('ColA', 'Desc') ->orderBy('ColA' - 'ColB', 'Desc') ->orderBy('ColC', 'Desc') ->orderBy('ColD', 'Asc') ->pluck('userId')-

anon40457's avatar
anon40457's avatar lostdreame...7yrs agoEloquent
3
1
Last reply by lostdreamer_nl 7yrs ago
ospevack's avatar

JSON $casts as Object - Issue with conversion to string

Hi all, i am trying to store json into a sqlite databse column, so i have the following in my eloquent model: protected $casts = [ 'json_data' => 'object']; i have populated the database with json in the json_data field, and it converts perfectly as a object when i recall the record. The problem arises when i try to updateOrCreate the record, i get the error: updateOrCreate(

ospevack's avatar
ospevack's avatar JonathanAs...1yr agoEloquent
7
2
Last reply by JonathanAspeling 1yr ago
Conterno's avatar

Access Certain Production Data from Testing Environment

I usually run my tests with an in-memory sqlite database. However, there is one production database that has information I need to properly perform certain tests within the testing environment. How can I get access to that production data if I specify a different database connection for my testing environment in phpunit.xml? It's not a huge dataset, around a hundred records. Bu

Conterno's avatar
Conterno's avatar ifpingram9yrs agoTesting
1
1
Last reply by ifpingram 9yrs ago

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.