screwtape_mk

screwtape_mk

Member Since 10 Months Ago

Experience Points 1,540
Experience Level 1

3,460 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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

19 Mar
2 days ago

screwtape_mk left a reply on Auth Middleware On A Button

so you mean the button should call a route - which will be the form modal - if not authenticated then it will redirect to the login page but if authenticated the modal will pop up - is that what you saying

screwtape_mk started a new conversation Auth Middleware On A Button

I have a button when pressed pop out a form modal. I have 2 things i need to do:

  1. Apply Auth Middleware on the button so that clicking the button redirects to the sign in page

  2. Save the URL before Authentication so that you store return it after loggin in.

I have an idea on how to do '2'.

'1' is what i need the most help in

14 Mar
1 week ago

screwtape_mk left a reply on Auth Middleware Reroutes To A Wrong Signin Page Auth.signin

Ok i solved it by going to the /Http/Middleware/Authenticate.php and changed this part of the code:

                  return redirect()->guest('auth.signin'); 

To:

                  return redirect()->guest('signin');

screwtape_mk started a new conversation Auth Middleware Reroutes To A Wrong Signin Page Auth.signin

I am using laravel 5.1 and i have applied an Auth middleware to a route, it works except my auth page is: /signin Not what it reroutes to /Auth.signin

12 Mar
1 week ago

screwtape_mk started a new conversation Accessing Array Element: Undefined Index

i dont understand why i get this error:

Undefined index: phone

while

$EmployeeArr=json_decode($Employees);
dd($EmployeeArr);

gives:

array:1 [▼
  0 => {#171 ▼
    +"id": "37"
    +"phone": "0828988008"
    +"EmployeeName": "Ownway Kanju"
    +"EmployeeService": "Photographer"
    +"suburb": "Broadacres AH"
    +"AccentCity": "Four Ways"
    +"distance": "3.2891828545855133"
    +"tasks": "0"
  }
]

yet when i run:

dd($EmployeeArr['phone']);

i get the error above

screwtape_mk left a reply on Argument 1 Passed To App\Models\User::BookingRequest() Must Be An Instance Of App\Models\userBookings, None Given, Called In ../laravel/app/Http/Controllers/SearchController.php On Line 41 And Defined

I have an Employee model:

    public function getEmployeeMobile()
    
        {
            if ($this->phone){
            
            return "{$this->phone}";
            }
            
            return null;
        
        }
    
    ```

screwtape_mk left a reply on Argument 1 Passed To App\Models\User::BookingRequest() Must Be An Instance Of App\Models\userBookings, None Given, Called In ../laravel/app/Http/Controllers/SearchController.php On Line 41 And Defined

Ok i have tried to approach this in a different way. The ultimate goal is to have a particular button showing 'number ' if a searched employee has been booked already by the Authenticated user Or show ''Book Me" if that employee has not been booked.

I have altered BookingRequest to:

    public function BookingRequest($EmployeeNumber)
    
    {
    
        return $this->bookings()->where('booking_status','=','confirmed')
                                ->OrWhere('Employee_Phone','=',$EmployeeNumber)
                                ->get();

    }

I now get this error

Call to undefined method Illuminate\Database\Eloquent\Collection::getEmployeeMobile()

when i :

dd($Employees->getEmployeeMobile());

in the SearchController:

<?php 
namespace App\Http\Controllers;

use DB;
use Auth;
use App\Models\Employee;
use App\Models\User;
use App\Models\Bookings;

use Illuminate\Http\Request;

use GuzzleHttp\Client;
use Session;



class SearchController extends Controller {

    public function getResults(Request $request)
    {
    
        $query1=implode("",$request->input('EmpService'));
        $query2=implode("",$request->input('AccCity'));
        
        
        $token=$request->input('g-recaptcha-response');
        
        
        if(!$query1){
            return redirect()->route('home');
        }
        
        $Employees=Employee::where(DB::raw('EmployeeService'),'LIKE',"%{$query1}%")
                    ->where('AccentCity','LIKE',"%{$query2}%")
                    ->get();
        
        
        dd($Employees->getEmployeeMobile());
11 Mar
1 week ago

screwtape_mk left a reply on Argument 1 Passed To App\Models\User::BookingRequest() Must Be An Instance Of App\Models\userBookings, None Given, Called In ../laravel/app/Http/Controllers/SearchController.php On Line 41 And Defined

its possible that the tutorial which has the the same

$bookingRequests=Auth::user()->BookingRequest() 

is a little simpler for the specific case im trying build for. in the tutorial the BookingRequest is defined within the user.php model as:


    public function BookingRequest(User $user)
    
    {
        return (bool)$this->bookings()->where('email',$user->email)
                                ->count();
                                
    }

screwtape_mk started a new conversation Argument 1 Passed To App\Models\User::BookingRequest() Must Be An Instance Of App\Models\userBookings, None Given, Called In ../laravel/app/Http/Controllers/SearchController.php On Line 41 And Defined

line 41 in searchController:

$bookingRequests=Auth::user()->BookingRequest();

User.php (Model):


    public function bookings() {
        
            return $this->hasMany('App\Models\Bookings');
    
    }   


    public function BookingRequest(userBookings $userBookings)
    
    {
        return (bool)$this->bookings()->where('email',$userBookings->email)
                                ->count();
                                
                                
                                
    
    }

The view:

@if(Auth::user()->BookingRequest($Userbookings))
                        <a href="#" class="btn btn-primary" data-toggle="modal" data-        
                            target="#bookingModal">Show Number</a>
@else
                
                        <a href="#" class="btn btn-primary" data-toggle="modal" data- 
                           target="#bookingModal">Book Me</a>
                        
@endif

Hope this is enough detail
10 Mar
1 week ago

screwtape_mk left a reply on Call To A Member Function Get() On Null

thanks so much super helpful!...cant believe i left out 'return'

09 Mar
1 week ago

screwtape_mk started a new conversation Call To A Member Function Get() On Null

I am trying to have a button of an employee show the text “Already booked” if the variable

count($bookingRequests)

returns something and if nothing then show “Book Me"

I have the following models and their relationships:

User.php and Bookings.php

User:

public function bookings() {
        
            return $this->hasMany('App\Models\Bookings');
    
    }   


    public function BookingRequest()
    
    {
        $this->bookings()->where('booking_status','=','confirmed')->get();  
    
    
    }


Bookings:

public function user(){
    
        return $this->belongsTo('App\Models\User');
    
    }

The view mentioned above is Employeeblock.blade.php:

    <div class="row no-gutters mb-5 mb-lg-0" style="padding:10px">
                
                    @if(count($bookingRequests))
                        <a href="#" class="btn btn-primary" data-toggle="modal" data-    
                                        target=“#bookingModal">Already Booked</a>
                    @else
                
                        <a href="#" class="btn btn-primary" data-toggle="modal" data- 
                                        target="#bookingModal">Book Me</a>
                        
                    @endif
                
         </div>

Which has data passed onto it by a controller SearchController:

In the following way:

<?php 
namespace App\Http\Controllers;

use DB;
use Auth;
use App\Models\Employee;
use App\Models\User;
use App\Models\Bookings;

use Illuminate\Http\Request;

use GuzzleHttp\Client;
use Session;

.
.
.
$bookingRequests=Auth::user()->BookingRequest()->get();

    return view(‘search.results’)->with('bookingRequests',$bookingRequests);

results.blade.php above has the following html:

<div class="panel panel-default">
            <div class="panel-heading"><h3></h3></div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
    
    
                                @foreach($Employees as $Employee)
                                        @include('user/partials/employeeblock')
                                @endforeach
    
    
        
                        </div>
                    </div>
                </div>
            </div>
</div>

06 Mar
2 weeks ago

screwtape_mk started a new conversation GuzzleHttp Undefined Offset: 1

Hi Guys

I am trying to integrate to a payment gateway and send sms'es from my application using GuzzleHttp:

i get the error in the tile and suspect is how i am passing the authentication as required by the API

Authentication requirement:

When using an API token, the value to be encoded will be <token-id>:<token-secret>. These values before Base64 encoding look something like this

BBDE1B476E03498AA768F66A286AABDC-01-B:9jSbVDK20!MXdfRGiIIFu#ffUE8*S

My API call:

        public function initiateSmsGuzzle($employeeMobile, $message)
                {
                  $client=new Client([
                    'headers'=>['content-type'=>'application/json','Accept'=>'application/json'],
                    ]);
                    
                    $ID=base64_encode('******_ID');
                    $KEY=base64_encode('******_KEY');

                     $response = $client->request('POST','https://api.bulksms.com/v1', [
                        'auth'=>[$ID.':'.$KEY],
                        'form_params' => [
                        
                        'message' => $message,
                        
                        'mobiles' => $employeeMobile,
                        ],
                ]);


        $response = json_decode($response->getBody(), true);
    }
    

The error above refers to this part of the Guzzle file:

laravel/vendor/guzzlehttp/guzzle/src/Client.php line 354

and that part contains this:

      if (!empty($options['auth']) && is_array($options['auth'])) {
            $value = $options['auth'];
            $type = isset($value[2]) ? strtolower($value[2]) : 'basic';
            switch ($type) {
                case 'basic':
                    // Ensure that we don't have the header in different case and set the new value.
                    $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
                    $modify['set_headers']['Authorization'] = 'Basic '
                        . base64_encode("$value[0]:$value[1]");  //THIS IS LINE 354
                    break;
                case 'digest':
                    // @todo: Do not rely on curl
                    $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
                    $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
                    break;
                case 'ntlm':
                    $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM;
                    $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
                    break;
            }
        }

screwtape_mk left a reply on Updated Models And Cache

I guess not and everything ran fine with the updated tables - thanks

screwtape_mk started a new conversation Updated Models And Cache

I have just updated some tables and views that are read by some of my Models. Please remind me if theres any cache that needs refreshing after doing so ?

05 Mar
2 weeks ago

screwtape_mk left a reply on Non-static Method App\Models\Employee::getEmployeeName() Should Not Be Called Statically, Assuming $this From Incompatible Context

No the id of the employee is not in the Request - subsequent methods in this controller use the request data, which i didnt include in this case

screwtape_mk started a new conversation Non-static Method App\Models\Employee::getEmployeeName() Should Not Be Called Statically, Assuming $this From Incompatible Context

I need to use a Model function in a controller but get the above error.

My Model:

<?php namespace App\Models;


use Illuminate\Database\Eloquent\Model;



class Employee extends Model 
{


    
    protected $table = ‘BLABLA’;
    

        public function getEmployeeName()
        
            {
                if ($this->EmployeeName){
            
                    return "{$this->EmployeeName}";
                    }
            
            return null;
        
            }
    
}

My controller:

<?php namespace App\Http\Controllers;


use Auth;

use DB;

use App\Models\Bookings;

use App\Models\User;

use App\Models\Employee;

use Illuminate\Http\Request;

class BookingsController extends Controller {

    public function postBooking(Request $request){

    $employee=Employee::getEmployeeName()->get();

    dd($employee);

}
    
    
    
}

screwtape_mk left a reply on Call To A Member Function GetName() On Null

@SNAPEY - A result of copying and pasting other applications but yeah was not necessary

04 Mar
2 weeks ago

screwtape_mk left a reply on Call To A Member Function GetName() On Null

well this is akward! I had no authenticated user...works now ! Thanks

screwtape_mk started a new conversation Call To A Member Function GetName() On Null

Hey Guys

I want to store the name of currently authenticated user into a variable $booker..but when i dd($booker) I get the error abover:

I have my User model as:


<?php namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;

use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;


class User extends Model implements AuthenticatableContract
{
use Authenticatable;

public function getName()
    
        {
            if ($this->name){
            
            return "{$this->name}";
            }
            
            return null;
        
        }
}

I have a controller called BookingsController:

<?php namespace App\Http\Controllers;


use Auth;

use DB;

use App\Models\Bookings;

use App\Models\User;

use Illuminate\Http\Request;

class BookingsController extends Controller {

public function postBooking(Request $request){


            
            $booker=Auth::User()->getName();
            dd($booker);
}

}

Its at that controller that i encounter that error

02 Mar
2 weeks ago

screwtape_mk left a reply on Send Notif Via WhatsApp

any success?

screwtape_mk left a reply on Send Whatsapp In Laravel App

Did you ever come right with this- i am also looking to send messages to user's whatsapp from my laravel application

01 Mar
2 weeks ago

screwtape_mk left a reply on Send Message From Laravel To Whatsapp

Thanks will check it out. Has anyone done whats suggested here successfully?

https://www.youtube.com/watch?v=F5gxk5xhEgo

screwtape_mk started a new conversation Send Message From Laravel To Whatsapp

Hey Guys

Any recommended link for this...?

25 Feb
3 weeks ago

screwtape_mk left a reply on Conditional Z-index Of Elements

I ended up with the same solution in my last comment - where i go within the view that would be rendered for logged in user and applied the following styling within:

.navbar
        {
        position:fixed;
                    
        z-index:0;
        }
                

screwtape_mk left a reply on Conditional Z-index Of Elements

I only want the z index lower for Authenticated users - i tried to set it inside the view that gets rendered for logged users by hardcoding z=index=0/

but ended up messing up with the navbar styling

screwtape_mk started a new conversation Conditional Z-index Of Elements

Hey Guys

So I have this blade autocomplete form thats in my application home landing page, but also gets rendered inside the navbar of logged in users.

The problem though is that for logged users the z- index of the autocomplete form seems to be lower than the navbar for which its a child element and therefore parts of the autocomplete list is hidden under the navbar increasing the z-index of the form works to solve my problem but only for the view thats rendered for logged users - but this also means form now has a higher z-index to the navbar in the home view. Hope this explanation makes sense:

Default View

<head>
//stuff goes here
</head>

 <section id="signup" class="signup-section">
       
    
            @include('templates.partials.navigation')
            
                
                    
                    
                        @include('templates.partials.alerts')
                        @yield('content')
                    

Navigation(navbar)

<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
    <div class="container">
     
      <a class="navbar-brand js-scroll-trigger" href="#page-top">BLABLA1</a> 
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-         
          target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle 
         navigation">
        Menu
        <i class="fas fa-bars"></i>
      </button>
      
      
      @if(Auth::check())
      
      <!-- Begin Insert Form                -->
            @include('search.autocompleteform')
      <!-- End Insert Form              -->
        
      @endif
        
        <div class="collapse navbar-collapse" id="navbarResponsive">
                <ul class="navbar-nav ml-auto">
                
                    @if(Auth::check())
                
                
                    <li class="nav-item">
                        <a class="nav-link js-scroll-trigger" href="#about">Show Bookings</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link js-scroll-trigger" href="#projects">BLABLA</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link js-scroll-trigger" href="{{route('auth.signout')}}">Sign out</a>
                    </li>
                    
                    @else
                    
                    <li class="nav-item">
                        <a class="nav-link js-scroll-trigger" href="{{route('auth.signup')}}">Register</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link js-scroll-trigger" href="{{route('auth.signin')}}">Login</a>
                    </li>
                    @endif
                    
                </ul>
        </div>
        
        
        
    </div>
  </nav>

Home view

@extends('templates.default')
@section('content')

<!-- @if(!Auth::check()) -->
 
    <div class="container">
      <div class="row">
        <div class="col-md-10 col-lg-8 mx-auto text-center">

          <i class="far fa-paper-plane fa-2x mb-2 text-white"></i>
          <h2 class="text-white mb-5">im looking for a professional around...</h2>


        <!-- You  will also need to  remove this and replace it wit the -->
        
            @include('search.autocompleteform')

        </div>
      </div>
    </div>
  </section>


Auto-complete form

   <form class="form-inline d-flex" action="{{route('search.results')}}" role="search" id="form">
            
            
                <input class="form-control autocomplete_txt input-lg flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" 
                   type='text' data-type="EmpService" id='EmpService_1' name='EmpService[]' autocomplete="off" placeholder="looking for...">
                   
                <input  class="form-control autocomplete_txt1 input-lg flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" 
                    type="text" data-type="AccCity" name="AccCity[]" id="AccCity_1"  autocomplete="off"  placeholder="suburb...">
                    
                
            
           
            
           @if(!Auth::check())
           
                <div class="col-xs-4 g-recaptcha" data-sitekey="****_"></div>
           
            @endif  
            
             <button type="submit" class="btn btn-primary mx-auto">Search</button>
          </form>
          

11 Feb
1 month ago

screwtape_mk left a reply on WhereNotIn Not Working

This is what ended up working :

$bookings=Auth::user()->bookings()->where('Payment_Status','!=','error')->get();

screwtape_mk left a reply on WhereNotIn Not Working

@SNAPEY - I am trying to EXCLUDE errors...

screwtape_mk started a new conversation WhereNotIn Not Working

Hi - i have the following query regarding the field Payment_Status which has either a 'completed' or 'error' :

I want to exclude the error payment statuses

When i apply the where clause as below it works..

$bookings=Auth::user()->bookings->where('Payment_Status','completed');

but when i apply the filter i really want to apply:

$bookings=Auth::user()->bookings->whereNotIn('Payment_Status','error');

I get the error:

Call to undefined method Illuminate\Database\Eloquent\Collection::whereNotIn()

10 Feb
1 month ago

screwtape_mk left a reply on Trying To Get Property Of Non-object

Thanks alot guys my problem is solved- i am not sure if the Case sensitive issue might have solved my problem. What i instead decided to do is to create a separate controller to handle '''bookings''' instead defining a method inside the AuthController. This way i had a better view of which models were used where. Thanks so much though

09 Feb
1 month ago

screwtape_mk started a new conversation Trying To Get Property Of Non-object

Hi Guys

I have the following variable:

    $bookings=Auth::User()->bookings;

and i get the error:

ErrorException Trying to get property of non-object

I have the following Models:

User:

    public function bookings() {
        
            return $this->hasMany('App\Models\Bookings');
    
    }   

Bookings:

    public function user(){
    
        return $this->belongsTo('App\Models\User');
    
    }

Route:

Route::get('/bookings',[
            'uses'=>'\App\Http\Controllers\[email protected]',
            'middleware'=>['guest'],

]);

Please assist i might have missed something

19 Dec
3 months ago

screwtape_mk left a reply on FATAL ERROR In ../storage/framework/views/4adc42dcb226305d1eac13e0ba17bb7c

Solved! I didnt have to clear cache but there was a line of code in the main view in which i hoped was commented out:

Apparently that was read by the compiler and through an exception

screwtape_mk left a reply on FATAL ERROR In ../storage/framework/views/4adc42dcb226305d1eac13e0ba17bb7c

The full error says:

FatalErrorException in 4adc42dcb226305d1eac13e0ba17bb7c line 17: syntax error, unexpected ','

Not sure why that must happen lets hope clearing cache fixes it

screwtape_mk started a new conversation FATAL ERROR In ../storage/framework/views/4adc42dcb226305d1eac13e0ba17bb7c

Hey Guys...whats the purpose of the files in that directory...i get a "Fatal Error, unexpected ','" Hope thats enough info.

I didnt write the codes in those files but they appear to resemble parts of my code in the normal

/laravel/resources/views directory.

16 Oct
5 months ago

screwtape_mk left a reply on Pass Multiple Array Variables To The Same View In A Controller

I have actually built a whole application based on CodeCourse videos going live at the end of the month. Thanks for the reccommendation

screwtape_mk started a new conversation Pass Multiple Array Variables To The Same View In A Controller

Hi

I have 2 Variable Arrays I wish to pass to a view; $Employees and $Payments.

My controller :

return view('search2.results2')->with('Employees',$Employees);

I also wish to pass:

return view('search2.results2')->with('Payments',$Payments);

Each of these arrays are very complex SQL views defined in my Model folder which i dont intend to make any more complex by making them ONE SQL View

08 Oct
5 months ago

screwtape_mk left a reply on Object Of Class StdClass Could Not Be Converted To String

Wow that was the issue! Thank you very much - works like a charm now

screwtape_mk left a reply on Cannot Use Object Of Type StdClass As Array

Thanks this worked but i now have issues inserting this data into a table. I have posted a seperate Question here:

https://laracasts.com/discuss/channels/laravel/object-of-class-stdclass-could-not-be-converted-to-string-3

screwtape_mk started a new conversation Object Of Class StdClass Could Not Be Converted To String

I have this snippet of code:

foreach ($data as $p_data) 
            {
            
                    $payments_data[] = 
            
                        [
                            'id'=>$p_data->id,
                            'status'=>$p_data->status,
                            'date'=>$p_data->date,
                            'totalAmount'=>$p_data->totalAmount,
                            'settleAmount'=>$p_data->settleAmount,
                            'tipAmount'=>$p_data->tipAmount,
                            'snapCode'=>$p_data->snapCode,
                
                            'userReference'=>$p_data->userReference,
                            'statementReference'=>$p_data->statementReference,
                            'extra'=>$p_data->extra,
                            'address1'=>$p_data->deliveryAddress,
                            'requiredAmount'=>$p_data->requiredAmount,
                            'merchantReference'=>$p_data->merchantReference,
                            'authCode'=>$p_data->authCode,
                 
                 
                            
                 
                        ];
                        
                        Payments::insert($payments_data);
            }        

The first iteration is inserted and then it fails and give this error

I get the error:

Object of class stdClass could not be converted to string

03 Oct
5 months ago

screwtape_mk left a reply on Cannot Use Object Of Type StdClass As Array

array:50 [▼ 0 => {#203 ▼ +"id": 52 +"status": "completed" +"totalAmount": 22000 +"tipAmount": 0 +"feeAmount": 759 +"settleAmount": 21241 +"requiredAmount": null +"date": "2018-07-29T13:07:22Z"

screwtape_mk started a new conversation Cannot Use Object Of Type StdClass As Array

I have an array of the type :

$data=

array:50 [▼ 0 => {#203 ▼ +"id": 52 +"status": "completed" +"totalAmount": 22000 +"tipAmount": 0 +"feeAmount": 759 +"settleAmount": 21241 +"requiredAmount": null +"date": "2018-07-29T13:07:22Z"

I am not sure how to reference it. When it do this $data['0']['id'] I get an error: Cannot use object of type stdClass as array

How do i reference this

25 Sep
5 months ago

screwtape_mk left a reply on Search Form Doesnt Work For Authenticated User

I will go for 2 functions - one for general public which will require a captcha verification and another for logged in users.

screwtape_mk left a reply on Search Form Doesnt Work For Authenticated User

i suspect the captcha verification in the second form since isnt showing is therefore not clicked and as a result the second form returns nothing. Can I apply the :

@if(!Auth::check())

inside the controller so that captcha verification is applied only to not logged in users?

screwtape_mk left a reply on Search Form Doesnt Work For Authenticated User

How do you mean by 'search functions'

Why do you name your fields with array brackets?

  • The form has an autocomplete search functionality

screwtape_mk left a reply on Search Form Doesnt Work For Authenticated User

The search Controller is :

class SearchController extends Controller {

public function getResults(Request $request)
{

    $query1=implode("",$request->input('EmpService'));
    $query2=implode("",$request->input('AccCity'));
    
    $token=$request->input('g-recaptcha-response');
    
    
    if(!$query1){
        return redirect()->route('home');
    }
    
    $Employees=Employee::where(DB::raw('EmployeeService'),'LIKE',"%{$query1}%")
                ->where('AccentCity','LIKE',"%{$query2}%")
                ->get();
                

screwtape_mk left a reply on Search Form Doesnt Work For Authenticated User

I think the issue is that i only have a a route defined for:

Route::get('/search',[ 'uses'=>'\App\Http\Controllers\[email protected]', 'as'=>'search.results',

]);

How would i then define a route for the second form in :

views/templates/partials/navigation.blade.php