gianmarx

gianmarx

Member Since 3 Months Ago

Pisa

Experience Points
13,770
Total
Experience

1,230 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
90
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 3
13,770 XP
Oct
21
1 week ago
Activity icon

Replied to ErrorException

it happens every time I do a pull from git. very often I solve by deleting the vendor folder and giving composer install. I solved by deleting everything and re-installing. @sinnbeck

Activity icon

Replied to ErrorException

give me error :

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

ErrorException

require(/home/forge/stage.it/vendor/laravel/jetstream/src/../routes/.php): failed to open stream: No such file or directory

at vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:144 140▕ / 141▕ protected function loadRoutesFrom($path) 142▕ { 143▕ if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) { ➜ 144▕ require $path; 145▕ } 146▕ } 147▕ 148▕ /*

  +14 vendor frames 

15 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}()

  +5 vendor frames 

21 artisan:37 Illuminate\Foundation\Console\Kernel::handle() Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

I tried with the following commands: rm -r vendor/ composer install composer dump-autoload

but I always get that error

Activity icon

Started a new Conversation ErrorException

when I launch the composer install it gives me this error can you help me

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

ErrorException

require(/home/forge/stage.it/vendor/laravel/jetstream/src/../routes/.php): failed to open stream: No such file or directory

at vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:144 140▕ / 141▕ protected function loadRoutesFrom($path) 142▕ { 143▕ if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) { ➜ 144▕ require $path; 145▕ } 146▕ } 147▕ 148▕ /*

  +14 vendor frames 

15 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}()

  +5 vendor frames 

21 artisan:37 Illuminate\Foundation\Console\Kernel::handle()

Oct
20
1 week ago
Activity icon

Awarded Best Reply on Search In Json Column With Laravel For Duplicate

@michaloravec i solved with json_encode.

 ->whereJsonContains('parameters',json_decode($request['paramjson'],TRUE))
Activity icon

Replied to Search In Json Column With Laravel For Duplicate

@michaloravec i solved with json_encode.

 ->whereJsonContains('parameters',json_decode($request['paramjson'],TRUE))
Activity icon

Replied to Search In Json Column With Laravel For Duplicate

not work:

$taskDuplicate = Task::where(name','=',$request['name'])
            ->where('field','=',$request['field'])
            ->where('paramjson','=',$request['paramjson'])
            ->get();
        }

return Illuminate\Database\Eloquent\Collection^ {#2923 #items: [] }

Activity icon

Replied to Search In Json Column With Laravel For Duplicate

i didn't understand, i translated the fields into array and it doesn't work @michaloravec

Activity icon

Replied to Search In Json Column With Laravel For Duplicate

does not work. then $ request is not an object but an array where $ request ['paramjson'] has a variable json field

Activity icon

Replied to Search In Json Column With Laravel For Duplicate

a json variable field. once upon a time I can have values like this {"a":"yes","b":"no"} or {"a":"yes","b":"no","c":"get"} and so on.

basically i have to check the whole json field, if check for duplicates

Activity icon

Started a new Conversation Search In Json Column With Laravel For Duplicate

I insert these data types in the DB:

"name" => "pilar" "field" => "B1" "paramjson" => "{"a":"yes","b":"no"}"

with the query I check if I find a value already present:

 $taskDuplicate = Task::where('name','=',$request['name'])
            ->where('field','=',$request['field'])
            ->whereJsonContains('paramjson',$request['paramjson'])
            ->get();

I also have to compare the json field, only the query thus always gives me empty together, if I remove where json works.

Oct
19
1 week ago
Activity icon

Replied to Test Laravel Jetstream

i used cypress to do e2 tests and how does it work with inertia.js? @yesaya

Activity icon

Replied to Page White Using App.js + Routes.js

as soon as I launched the command everything started. I had done it even before, only that I had not entered About and its import because I believed it was omitted. In theory it shouldn't work even without about @sinnbeck

Activity icon

Replied to Page White Using App.js + Routes.js

[email protected] assets % npm run watch

@ watch /Users/gianmarx/laracast/assets npm run development -- --watch

@ development /Users/gianmarx/laracast/assets cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

10% building 1/1 modules 0 active webpack is watching the files…

98% after emitting SizeLimitsPlugin

DONE Compiled successfully in 943ms 11:53:11

   Asset     Size   Chunks             Chunk Names

/css/app.css 0 bytes /js/app [emitted] /js/app /js/app.js 430 KiB /js/app [emitted] /js/app

Activity icon

Replied to Page White Using App.js + Routes.js

yes I made the change and the About.vue file exists

Activity icon

Replied to Page White Using App.js + Routes.js

app.js:15918 Uncaught ReferenceError: About is not defined at Module../resources/js/routes.js (app.js:15918) at webpack_require (app.js:20) at Module../resources/js/app.js (app.js:15819) at webpack_require (app.js:20) at Object.0 (app.js:15931) at webpack_require (app.js:20) at app.js:84 at app.js:87

always blank page

Activity icon

Replied to Page White Using App.js + Routes.js

Uncaught ReferenceError: About is not defined at Module../resources/js/routes.js (app.js:15918) at webpack_require (app.js:20) at Module../resources/js/app.js (app.js:15819) at webpack_require (app.js:20) at Object.0 (app.js:15931) at webpack_require (app.js:20) at app.js:84 at app.js:87 ./resources/js/routes.js @ app.js:15918 webpack_require @ app.js:20 ./resources/js/app.js @ app.js:15819 webpack_require @ app.js:20 0 @ app.js:15931 webpack_require @ app.js:20 (anonymous) @ app.js:84 (anonymous)

Activity icon

Started a new Conversation Page White Using App.js + Routes.js

I am taking this course https://laracasts.com/series/laravel-vue-and-spas/episodes/1 min 05:18

I should see the homepage that says home but I see the blank page

app.js

import Vue from 'vue';
import VueRouter from 'vue-router';
import routes from './routes';

Vue.use(VueRouter);

let app = new Vue({
    el: '#app',

    router: new VueRouter(routes)
});

routes.js

import Home from './components/Home';
export default{
	mode:'history',
	routes:[
		{
			path:'/',
			component:Home

		},
		{
			path:'/about',
			component:About

		},
	]
};

welcome.blade

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css2?family=Nunito:[email protected];600;700&display=swap" rel="stylesheet">

        <!-- Styles -->
        <style>
            /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}[hidden]{display:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}a{color:inherit;text-decoration:inherit}svg,video{display:block;vertical-align:middle}video{max-width:100%;height:auto}.bg-white{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.bg-gray-100{--bg-opacity:1;background-color:#f7fafc;background-color:rgba(247,250,252,var(--bg-opacity))}.border-gray-200{--border-opacity:1;border-color:#edf2f7;border-color:rgba(237,242,247,var(--border-opacity))}.border-t{border-top-width:1px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.items-center{align-items:center}.justify-center{justify-content:center}.font-semibold{font-weight:600}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}.leading-7{line-height:1.75rem}.mx-auto{margin-left:auto;margin-right:auto}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.max-w-6xl{max-width:72rem}.min-h-screen{min-height:100vh}.overflow-hidden{overflow:hidden}.p-6{padding:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-8{padding-top:2rem}.fixed{position:fixed}.relative{position:relative}.top-0{top:0}.right-0{right:0}.shadow{box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}.text-center{text-align:center}.text-gray-200{--text-opacity:1;color:#edf2f7;color:rgba(237,242,247,var(--text-opacity))}.text-gray-300{--text-opacity:1;color:#e2e8f0;color:rgba(226,232,240,var(--text-opacity))}.text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}.text-gray-500{--text-opacity:1;color:#a0aec0;color:rgba(160,174,192,var(--text-opacity))}.text-gray-600{--text-opacity:1;color:#718096;color:rgba(113,128,150,var(--text-opacity))}.text-gray-700{--text-opacity:1;color:#4a5568;color:rgba(74,85,104,var(--text-opacity))}.text-gray-900{--text-opacity:1;color:#1a202c;color:rgba(26,32,44,var(--text-opacity))}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--bg-opacity:1;background-color:#2d3748;background-color:rgba(45,55,72,var(--bg-opacity))}.dark\:bg-gray-900{--bg-opacity:1;background-color:#1a202c;background-color:rgba(26,32,44,var(--bg-opacity))}.dark\:border-gray-700{--border-opacity:1;border-color:#4a5568;border-color:rgba(74,85,104,var(--border-opacity))}.dark\:text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.dark\:text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}}
        </style>

        <style>
            body {
                font-family: 'Nunito';
            }
        </style>
    </head>
    <body>
        <div id="app">
            <router-view></router-view>
        </div>
        <script src="/js/app.js"></script>
    </body>
</html>

unfortunately I keep seeing the blank page

Activity icon

Started a new Conversation Error Vue In Course Vue SPas

I am taking this course:https://laracasts.com/series/laravel-vue-and-spas/episodes/1 min 05:04.

when I issue the command:

npm run watch

gives following error:

ERROR in ./resources/js/app.js Module not found: Error: Can't resolve 'vue' in '/Users/gianmarx/laracast/assets/resources/js' @ ./resources/js/app.js 3:0-22 6:0-3 7:14-17 @ multi ./resources/js/app.js ./resources/css/app.css

Activity icon

Commented on The Skeleton

i didn't understand where to save route.js? 2:53

Oct
16
1 week ago
Activity icon

Started a new Conversation Test Payment Automatic Cypress

i have this problem with test cypress:

Oct
14
2 weeks ago
Activity icon

Started a new Conversation Cypress Problems Take Value And Compare It. Scope Variable

I have this HTML structure:

<tr id="post-7053" class="iedit author-other level-0 post-7053 type-poi status-publish hentry webmapp_category-corbezzolo" data-id="7053">
   <th scope="row" class="check-column">
      <label class="screen-reader-text" for="cb-select-7053">
      Seleziona 594			</label>
      <input id="cb-select-7053" type="checkbox" name="post[]" value="7053">
      <div class="locked-indicator">
         <span class="locked-indicator-icon" aria-hidden="true"></span>
         <span class="screen-reader-text">
         “594” è bloccato				</span>
      </div>
   </th>
   <td class="5da0bb937bd9f column-5da0bb937bd9f has-row-actions column-primary column-postid" data-colname="ID">7053

I have to take the value of an ID and compare it on another site:

i have to get the first table id i managed to get it with this cypress command:

  id = cy.get('tbody#the-list td').first().invoke('val')

only that when I go to compare the value of the variable id. it never enters the if branch. While if I put a value like 7156 or other it enters the if branch and makes the comparison.

below the test code:

describe('Registration', () => {
    const email = '[email protected]'
    const password = 'pedhu'
    var id

  it('create new Nedo', () => {
      cy.visit('https://test.nedo/wp-admin')
      cy.get('input[name=log]').type(email)
      cy.get('input[name=pwd]').type(password)
      cy.get('input#wp-submit').click()

      cy.visit('https://test.nedo/edit.php?post_type=nedo')

      id = cy.get('tbody#the-list td').first().invoke('val')

   })

   it('id', () => {
    cy.visit('https://nedostaging.z.hu/login')
    cy.get('input[name=email]').type('[email protected]')
    cy.get('input[name=password]').type('nedo')
    cy.get('button').contains('Login').click()
    cy.get('#hometable > tbody > tr > td:nth-child(4)').each(($e, index, $list) => {
        const text = $e.text()
        cy.log(id)
        if (text.includes(id)) {//if I put a number instead of id it works
            assert.strictEqual(text, '{"id":'+id+'}', 'id nedo ok')
        }

    })

  })
Activity icon

Replied to Symfony\Component\Routing\Exception\RouteNotFoundExceptionRoute [login] Not Defined

I deleted and reloaded the project now it gives me error 500

Activity icon

Started a new Conversation Symfony\Component\Routing\Exception\RouteNotFoundExceptionRoute [login] Not Defined

downloaded a laravel project from git with jetstream.

I ran the following commands because I was having trouble starting it.

I deleted the vendor folder with:

rm -r vendor/

Re-run:

composer install 

and then

composer dump-autoload 

now if I launch php artisan I need it part but it gives me the following error:

Symfony\Component\Routing\Exception\RouteNotFoundExceptionRoute [login] not defined

Oct
12
2 weeks ago
Activity icon

Replied to Test Laravel 8x: Mail Reception

what is possible to do with Laravel 8x and what is not possible to do with what I said above? @sinnbeck

Activity icon

Replied to Test Laravel 8x: Mail Reception

I explained myself wrong. I would like to send an email with Laravel and verify that it has arrived. Also Check the content sent @sinnbeck

Activity icon

Started a new Conversation Test Laravel 8x: Mail Reception

Is it possible to test receiving an email with Laravel?

or can I use only mock mail tests?

I haven't found much about the documentation, just this: https://laravel.com/docs/8.x/mocking#mail-fake

Activity icon

Started a new Conversation Test Mail Laravel 8x

about this episode: https://laracasts.com/series/phpunit-testing-in-laravel/episodes/12

Since this episode was recorded in 2016 I wonder if the proposed method is still valid even with Laravel version 8. I also wonder if other more “ou of the box” methods have been planned at the moment.

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

the seed must start eventually @sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

  1. Tests\Feature\updateErrorApiTest::testNotAuthorizedIdSUpdateErrorApiHoqu InvalidArgumentException: Database connection [testing] not configured.

i put the code as follows

    public function testSushi()
    {
        $user_tokens = json_decode(Storage::get('test_data/tokens_users.json'),TRUE);

        //add data with api/queues
        $data = [
            "poll_in" => "https:\/\/ok.org",
            "category" => "sushi",
            "param" => ["a"=> "yes", "b"=> "no", "c" => "so and so", "d"=>"maybe"],
        ];
        $response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '.$user_tokens['[email protected]']
        ])->post('/api/store',$data);
        $response->assertStatus(201);

    }




    public function setUp(): void
    {
        parent::setUp();
        $this->artisan('migrate:fresh', ['--path' => 'database/migrations', '--database' => 'testing']);
        $this->artisan('db:seed');
    }



}
Activity icon

Replied to Launch From Php Code Artisan Db: Seed

I did not understand where to put this function?

I tried to insert it in the test but it gives me an error @sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

PHP Fatal error: Uncaught ParseError: syntax error, @sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

if you can show me how you would have extended the test case to do db: seed? that I understand well how to implement it @sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

usual mistake.

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

namespace Tests\Feature; use App\Models\Task; use App\Models\User; use Laravel\Sanctum\Sanctum; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Support\Facades\Storage; use Tests\TestCase; use App\Console\Commands\SeedCommand;

class ApiTest extends TestCase
{

    $this->call('db:seed');

}

@sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;

class SeedCommand extends Command
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'seed {--database=} {--path=} {--force} {--seed} {--class=}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {

        Artisan::call('db:seed');
    }
}

unfortunately when I go to call him back in the test he gives me an error:

$this->call('db:seed');//ide marks this as an error

@sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

OK but I didn't understand how to do the class... ? @sinnbeck

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

if I give him the following command he gets angry the idea gives it to me as an error

Artisan::call('db:seed');

@michaloravec

Activity icon

Replied to Launch From Php Code Artisan Db: Seed

how do i extend it? @sinnbeck

Activity icon

Started a new Conversation Launch From Php Code Artisan Db: Seed

how can i run the command in the code:

php artisan db:seed 

I would need it to be able to repole the db at the end of each test

Oct
09
2 weeks ago
Activity icon

Replied to Test APi Token With Permissions Problem

ok I found that it fails when I do this check in the update $ request->user()->tokenCan('update') basically I don't update the user. does the old user remain set and the check fails? @sergiu17

Oct
08
3 weeks ago
Activity icon

Replied to Test APi Token With Permissions Problem

it only works if you put the store in one method and update it in another method. It seems to me a bad solution @sergiu17

Activity icon

Replied to Test APi Token With Permissions Problem

Expected status code 200 but received 403. Failed asserting that 200 is identical to 403.

same result @sergiu17

Activity icon

Replied to Test APi Token With Permissions Problem

Expected status code 200 but received 403. Failed asserting that 200 is identical to 403.

same result :-( @sergiu17

$response = $this->withHeaders([ 'Accept' => 'application/json', 'Authorization' => 'Bearer '.$tokenA], ])->post('/api/store',$data); $response->assertStatus(201);

$this->flushHeaders()

$response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '.tokenB,
        ])->put('/api/update',$dataUpdate);
        $respone->assertStatus(200);
Activity icon

Started a new Conversation Test APi Token With Permissions Problem

i generated two tokens:

tokenA = As2 ... xxxxx //can perform ONLY  create
tokenB = Bs2 ... xxxxx //can perform ONLY update

i have the following problem

$response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '.$tokenA],
        ])->post('/api/store',$data);
        $response->assertStatus(201);

//the store is made without problems

$response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '.tokenB,
        ])->put('/api/update',$dataUpdate);
        $respone->assertStatus(200);

//the test fails and returns 403. As if you don't have permission to do that

while if I call only

$response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '.tokenB,
        ])->put('/api/update',$dataUpdate);
        $response->assertStatus(200);

the update is performed without problems.

How can I run the store and then the update in sequence?

it appears that $ response continues to hold the value of tokenA

Activity icon

Replied to Request That Passes Values Into WhereIn Finds No Values That Are There

the query is performed inside a method of a controller. when the test calls the method where inside there is the function even if I write a simple query orm like:

Task::first();

and I do the dd returns .null

while if I call the same query inside the test it works. I don't understand what the problem is ? @michaloravec @tray2

Activity icon

Replied to Request That Passes Values Into WhereIn Finds No Values That Are There

"B" => array:3 [ 0 => "dog" 1 => "cat" 2 => "horse" ]

as I wrote earlier.

the db is full of those corresponding values only it takes nothing @tray2

Activity icon

Replied to Request That Passes Values Into WhereIn Finds No Values That Are There

then if I use get() it gives me:

.Illuminate\Database\Eloquent\Collection^ {#1930

#items: [] }

if I use first()

.null

@michaloravec

I don't understand why it gives me empty set, when the db is full of those values and I pass an array in whereIn

Activity icon

Replied to Request That Passes Values Into WhereIn Finds No Values That Are There

the problem is that I only want one line so first () is required @michaloravec

Activity icon

Started a new Conversation Request That Passes Values Into WhereIn Finds No Values That Are There

I pass the following data as request

$request= [
        "A" => 10,
        "B" => ["dog", "cat", "horse"]
    ];

in the db I have a lot of data under name_animal

I'm going to run the following query

$task = Task::whereIn('name_animal', $request['B'])->first();

the query is always null. But the db is full of those values

if I do a DD of the request I get

+request: Symfony\Component\HttpFoundation\ParameterBag^ {#1877
#parameters: array:2 [
  "A" => 10
  "B" => array:3 [
    0 => "dog"
    1 => "cat"
    2 => "horse"
  ]
]

}