ArthurDiniz

Experience

210

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

15th September, 2017

ArthurDiniz left a reply on Relationship User->Service->Bill • 1 week ago

No problem. But it is not listing anything

ArthurDiniz left a reply on Relationship User->Service->Bill • 1 week ago

@tykus No problem, u r helping a lot.... I did it but it throws : Method paginate does not exist.

ArthurDiniz left a reply on Relationship User->Service->Bill • 1 week ago

It worked.... no error in SQL but now i have an error in the view Method links does not exist. And when i try to paginate Method paginate does not exist.

ArthurDiniz left a reply on Relationship User->Service->Bill • 1 week ago

@tykus SQLSTATE[42S22]: Column not found: 1054 Unknown column 'services.user_id' in 'field list' (SQL: select bills.*, services.user_id from bills inner join services on services.id = bills.service_id where services.user_id = 1)

my database have services_id and users_id. they r in plural

ArthurDiniz started a new conversation Relationship User->Service->Bill • 1 week ago

Hello, im trying to list only the Bills of the user logged in. I have on the database (oneToMany) User hasMany Services(users_id-FK) Services hasMany Bills(services_id -FK) Here is my code:

    public function index()
        {
            $user = Auth::user()->id;
            $services = Service::where('users_id','=', $user);
            $bills = Bill::where('services_id','=', $services->id)->paginate(10);
            return view('bills.index')->withBills($bills);
    };

I know its wrong... I want to list every bill by every services of the user ....

13th September, 2017

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

@wickley thk u. I used just to see if i was passing the log in user, but got stuck on how to hide that field or remove it....

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

@spodlogar can u explain somethin? do i need to use

    $user = Auth::user();
        return view('services.create')->withUser($user);

in every function , controller?

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

Thx it work

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

And in the view i delete the user form?

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

But i want to save on the database. How can i pass it without the form?

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

@vanderb solved it! the problem was in this line Old

 {{ Form::text('users_id',$user->id,['disabled'=>'disabled','class' => 'form-control','required' => '', 'maxlenght' => '10'])}}

I deleted the 'disabled'

Now

{{ Form::text('users_id',$user->id,['class' => 'form-control','required' => '', 'maxlenght' => '10'])}}

But how can i block the field so users can not edit?

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

How do i implement csrf-field? Do i put at the end of the form? Yes i used resource-routes

ArthurDiniz left a reply on Laravel Not Throwing Error Saving • 1 week ago

What u mean by missing information?

im sorry my english is poor

ArthurDiniz started a new conversation Laravel Not Throwing Error Saving • 1 week ago

Hi, im developing my first project, and when i try to save a service it does not save. It just refresh the create page.

Create View


{!! Form::open(['route' => 'services.store','method' => 'post']) !!}
                    {{ Form::label('name','Name:')}}
                    {{ Form::text('name',null,array('class' => 'form-control','required' => '', 'maxlenght' => '50'))}}

                    {{ Form::label('users_id','User:',['style'=>'margin-top: 20px;'])}}
                    {{ Form::text('users_id',$user->id,['disabled'=>'disabled','class' => 'form-control','required' => '', 'maxlenght' => '10'])}}
                    

                    {{ Form::label('phone','Phone:',['style'=>'margin-top: 20px;'])}}
                    {{ Form::text('phone',null,array('class' => 'form-control','required' => '', 'maxlenght' => '10'))}}

                    {{ Form::label('razsocial','Raz Social:')}}
                    {{ Form::text('razsocial',null,array('class' => 'form-control','required' => '', 'maxlenght' => '50'))}}

                    {{ Form::label('seller','Seller:')}}
                    {{ Form::text('seller',null,array('class' => 'form-control','required' => '', 'maxlenght' => '50'))}}     

                    {{ Form::label('sellerphone','Seller Phone:')}}
                    {{ Form::text('sellerphone',null,array('class' => 'form-control','required' => '', 'maxlenght' => '10'))}}                     


                    {{ Form::submit('Create Service',array('class' => 'btn btn-success btn-lg btn-block','style' => 'margin-top: 20px;'))}}
                    {!! Form::close() !!}

ServiceController


public function create()
    {
        $user = Auth::user();
        return view('services.create')->withUser($user);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //Validate de data
        $this->validate($request, array(
                'name'        => 'required|max:45',
                'phone'       => 'required|max:10',
                'users_id'    => 'required|integer',
                'razsocial'   => 'required|max:50',
                'seller'      => 'required|max:50',
                'sellerphone' => 'required|max:10',

            ));
      
  
        //Store in the Database
        $service = new Service;

        $service->name = $request->name;
        $service->phone = $request->phone;
        $service->users_id = $request->users_id;
        $service->razsocial  = $request->razsocial;
        $service->seller = $request->seller;
        $service->sellerphone = $request->sellerphone;

        $service->save();

        Session::flash('success','The service was succesfully save!');

        //Redirect to Another Page
        return redirect()->route('services.show', $service->id);
    }

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.