artisticre

artisticre

Member Since 2 Years Ago

Experience Points
5,210
Total
Experience

4,790 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
20
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 2
5,210 XP
Feb
20
2 days ago
Activity icon

Started a new Conversation Store Function

This code is getting caught up in the validator and takes it back to teamapp/create. Not sure why. There are more fields in the database that I am not using yet. Just want to make the store function work first. Any ideas?

 public function store()
   {
     $app = array(
       'name' => 'required'
     );
     $validator = Validator::make(Input::all(), $app);

     if  ($validator->fails()) {
         return Redirect::to('teamapp.create')
         ->withErrors($validator)
         ->withInput(Input::except('password'));
       } else {
         $teamapp = new Team;
         $teamapp->name = Input::get('name');

         $teamapp->save();

         Session::flash('message', 'Team Application Successfully created!');
         return Redirect::to('teamapp.show');
       }

   }

Jan
29
3 weeks ago
Activity icon

Replied to SQLSTATE[HY000]: General Error:

Thank you. Totally forgot about mass assignments

Activity icon

Started a new Conversation SQLSTATE[HY000]: General Error:

I can't find my error why the values for homephone and cellphone are not being identified

my register form with the two values in it

<div class="form-group row">
                            <label for="homephone" class="col-md-4 col-form-label text-md-right">{{ __('Home Phone') }}</label>

                            <div class="col-md-6">
                                <input id="homephone" type="text" class="form-control @error('homephone') is-invalid @enderror" name="homephone" value="{{ old('homephone') }}" required autocomplete="homephone" autofocus>

                                @error('homephone')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>


                        <div class="form-group row">
                            <label for="cellphone" class="col-md-4 col-form-label text-md-right">{{ __('Cell Phone') }}</label>

                            <div class="col-md-6">
                                <input id="cellphone" type="text" class="form-control @error('cellphone') is-invalid @enderror" name="cellphone" value="{{ old('cellphone') }}" required autocomplete="cellphone" autofocus>

                                @error('cellphone')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

My register controller with the validation and create

protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'address' => ['required', 'string', 'max:255'],
            'apt' => ['nullable','max:15'],
            'city' => ['required', 'string','max:255'],
            'state' => ['required', 'string', 'max:255'],
            'zipcode' => ['required', 'string', 'max:25'],
            'homephone' => ['required', 'string', 'max:25'],
            'cellphone' => ['required', 'string', 'max:25'],
            'homechurch' => ['required', 'string', 'max:255'],
            'homechurchcity' => ['required', 'string', 'max:255'],
            'pastorname' => ['required', 'string', 'max:255'],
            'lastweekendserved' => ['required','string','max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        $user =  User::create([
            'name' => $data['name'],
            'address' => $data['address'],
            'apt' => $data['apt'],
            'city' => $data['city'],
            'state' => $data['state'],
            'zipcode' => $data['zipcode'],
            'homephone' => $data['homephone'],
            'cellphone' => $data['cellphone'],
            'homechurchcity' => $data['homechurchcity'],
            'pastorname' => $data['pastorname'],
            'lastweekendserved' => $data['lastweekendserved'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);

        $role = Role::select('id')->where('name', 'user')->first();

        $user->roles()->attach($role);
       
        return $user;

    }
Jan
23
4 weeks ago
Activity icon

Started a new Conversation Delete Not Working With Resource Route

This is the error I am getting.

The GET method is not supported for this route. Supported methods: PUT, PATCH, DELETE.

My Route

Route::namespace('Admin')->prefix('admin')->name('admin.')->group(function(){
    Route::resource('/users', 'UsersController', 
    ['except' => 'show', 'create', 'store']);
});

controller

 public function destroy(User $user)
    {
        $user->roles()->detach();
        $user->delete();
        return redirect()->route('admin.users.index');
    }

delete form

<form action="{{ route('admin.users.destroy', $user) }}" method="POST">
                                            @csrf
                                            {{ method_field('DELETE')}}
                                        <a href="{{ route('admin.users.destroy', $user->id) }}"><button class="btn btn-warning" type="button">Delete</button></a></td>
                                        </form>
Jan
22
1 month ago
Activity icon

Replied to Phone Formatting Issue

would that be a problem in the edit function? It only happens when the user updates the profile but doesn't update the phone number. Its like it is running the function and adding the formatting even though nothing has changed.

Activity icon

Replied to Phone Formatting Issue

How would I use this? This is the function I have now. How would integrate this that you gave me to the one I have now?

 private function formatPhone($value)
    {
        $ac = substr($value, 0,3);
        $prefix = substr($value,3,3);
        $suffix = substr($value, 6);
    
        return "({$ac}) {$prefix}-{$suffix}";
    
    }
Jan
17
1 month ago
Activity icon

Replied to Phone Formatting Issue

I have no idea how to do that. Any suggestions?

Activity icon

Started a new Conversation Phone Formatting Issue

I am using a phone formatting function in my model and it works when first inputted. But if the profile is updated, it gets weird. Here is my function

 public function getPhoneAAttribute($value)
    {
    
        return $this->formatPhone($value);
    }
    
    
    public function getPhoneMAttribute($value)
    {
    
        return $this->formatPhone($value);
    }
    
    
    private function formatPhone($value)
    {
        $ac = substr($value, 0,3);
        $prefix = substr($value,3,3);
        $suffix = substr($value, 6);
    
        return "({$ac}) {$prefix}-{$suffix}";
    
    }

Here is what happens. It only happens if the profile updates but no change happens to the phone number

(((8) 0) -1) -555-1212
Jan
16
1 month ago
Activity icon

Started a new Conversation Formatting

I have code I put in the value of an input to check to see if there is a value else print N/A The code works but it is putting the value in the center of the input. How do I left align it?

<input id="apt" type="text" 
                                        value="{{ $user->apt}} @if(is_null($user->apt))
                                        {{$user->apt}}
                                        
                                      @else
                                      <?php echo "N/A"?>
                                      @endif"
                                        class="form-control @error('apt')is-invalid @enderror" name="apt" autocomplete="apt" autofocus>
Jan
08
1 month ago
Activity icon

Replied to Checkbox

But if there are multiple checkboxes, it wouldn't be checked or not checked?

Activity icon

Replied to Checkbox

Yes I am wanting to store multiple options or none, depending on what they choose. So if I add this rule in the validator, do I add the array to the input on the form as well? Such as

name="services[]"
Activity icon

Replied to Checkbox

I have a checkbox named services and then the options would be service 1, service 2, service 3. Any can be clicked or none can be clicked. I don't understand how to put it in validation and input into the database.

Activity icon

Started a new Conversation Checkbox

I am dealing with a three option checkbox. In the validator, do I do it as boolean?

'checkbox' => ['required', 'boolean', 'max:255'],

and in the store function how do I input it?

Jan
07
1 month ago
Activity icon

Replied to Prepopulating A Form

I have a user form filled out during registration. Then they click on the team application and the application is there. Part of it is prefilled from the user table and the rest is the application. Then it is submitted to the application table

Activity icon

Replied to Prepopulating A Form

Looking at this, I see its not right but not sure what to do


Route::resource('team', 'TeamApplicationController')->middleware('auth');

<a href="{{url('team/create')}}">
Activity icon

Replied to Prepopulating A Form

ErrorException (E_ERROR) Undefined variable: user (View: C:\wamp64\www\lcteam\resources\views\team\create.blade.php) Previous exceptions Undefined variable: user (0)

Activity icon

Replied to Prepopulating A Form

OK this is what I did and I get Undefined variable: user My Controller

 public function create()
    {
       

        return view('team.create');
    }

  public function preview(Request $request, $id)
  {
      $user = User::where('id', $id)->firstOrFail();
      return view('team.create', compact('user'));
  }

And in my form:

value="{{ $user->name}}"
Activity icon

Replied to Prepopulating A Form

 public function create($id)
    {
        $user = User::find($id);
        
        //   return view('team/create', compact($user));
        return View::make('team.create')->with('user', $user);
    }
Activity icon

Replied to Prepopulating A Form

So I have this now

public function create($id)
    {
         $user = User::find($id);
        
          return view('team.create',compact($user));
    }

and I get this error:

Too few arguments to function App\Http\Controllers\TeamApplicationController::create(), 0 passed and exactly 1 expected
Jan
06
1 month ago
Activity icon

Started a new Conversation Prepopulating A Form

I have an application form I want to prepopulate certain fields from the user table. I tried the following code but got too few parameters error. What am I doing wrong?

public function create($id)
    {
         $user = User::find($id);
        
          return view('team.create')->with('user', $user);
    }

On my create page I have values like this on the fields I want populated.

value="{{ $user->name}}"
Activity icon

Started a new Conversation Trying To Understand Models

I am getting this error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lcteam.teams' doesn't exist (SQL: select * from teams)...Not sure where it is calling the lcteam.teams table? I need to change this to lcteam.application

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Team extends Model
{
    //
}

public function index() {

    $teams = Team::all();
    return View::make('team.index')
        ->with('teams', $teams);
}
Dec
10
2 months ago
Activity icon

Replied to Too Few Arguments

I am using that Request and using using Resource Controller

Activity icon

Replied to Too Few Arguments

I did this and got Missing required parameters for [Route: update] [URI: profile/{id}].

Route::put('/profile/{id}', '[email protected]')->name('update');

Activity icon

Started a new Conversation Too Few Arguments

I am getting this error but cannot figure out why

Too few arguments to function App\Http\Controllers\ProfilesController::update(), 1 passed and exactly 2 expected

public function update(Request $request, $id)
    {
        $this->validate($request, [
            'name' => 'required'
            
        ]);
        $user = User::find($id);
         // Handle File Upload
        
        // Update Post
        $user->name = $request->input('name');
         
        $user->save();
        return redirect('profile.profile')->with('success', 'Profile Updated');
    }
Dec
09
2 months ago
Activity icon

Started a new Conversation Boolean Yes/No

I have the following function that displays all the data but I have a radio button and its displaying 1 or 0 instead of yes or no. How can I convert this?

 public function index() {
        
        $userProfile = auth()->user();
        
        return view('profile.profile')->with(compact('userProfile'));
      }

Activity icon

Replied to Phone Format Not Working

yes. It is pulling data from those fields but not in phone number display such as xxx-xxx-xxxx

Activity icon

Replied to Phone Format Not Working

I did this but it doesn't work

public function getPhoneAAttribute($value)
{

    return $this->formatPhone($value);
}


public function getPhoneMAttribute($value)
{

    return $this->formatPhone($value);
}


private function formatPhone($value)
{
    $ac = substr($value, 1,3);
    $prefix = substr($value,4,3);
    $suffix = substr($value, 7);

    return "({$ac}) {$prefix}-{$suffix}";

}
Activity icon

Replied to Phone Format Not Working

so in the model:

    public function getPhoneMAttribute($value)
{

    return $this->formatPhoneM($value);
}

 private function formatPhoneM($value)
    {
        $ac = substr($value, 1,3);
        $prefix = substr($value,4,3);
        $suffix = substr($value, 7);
    
        return "({$ac}) {$prefix}-{$suffix}";
    
    }

Activity icon

Replied to Phone Format Not Working

I guess I am not understanding how it applies to phoneM and phoneA>?

Activity icon

Replied to Phone Format Not Working

OK I see it now. I have a phoneM and phoneA that I want to add this code to. How can I adjust the code to using phoneA and phoneM?

Activity icon

Replied to Phone Format Not Working

I am hoping the phone number would put xxx-xxx-xxxx but it just lists the phone number like xxxxxxxxxx

Activity icon

Replied to Phone Format Not Working

one off by what?

Activity icon

Replied to Phone Format Not Working

actually I have a phoneM and phoneA for phonemain and phonealt

Activity icon

Started a new Conversation Phone Format Not Working

I have a phone format that used to work but isn't this time. Can someone help me out?

public function getPhoneAttribute($value)
{
    $ac = substr($value, 1,3);
    $prefix = substr($value,4,3);
    $suffix = substr($value, 7);

    return "({$ac}) {$prefix}-{$suffix}";
}
    
    public function index() {
        
        $userID = Auth::user()->id;
        $userProfile = DB::table('users')->where('id', $userID)->first();
      
        return view('profile.profile')->with(compact('userProfile'));
        

    }
<div class="container m-t-100 text-center">
<div class="row">
    <div class="col-12"><h1 class="text-center font-weight-bold">
        {{ $userProfile->name}}</h1>
    <h5 class="profileaddress">{{ $userProfile->address}} 
        <span class="icon"><i class="fa fa-circle m-b-10"></i></span>
   {{ $userProfile->city }} <span class="icon"><i class="fa fa-circle m-b-10"></i></span> 
   {{ $userProfile->state }} <span class="icon"><i class="fa fa-circle m-b-10"></i></span> {{ $userProfile->zipcode }}</h5>
</div>
</div>
<div class="row m-t-50">
    <div class="col-6">
        <h4 class="font-weight-bold">Phone (Main) - <span class="profilecolor">{{ $userProfile->phoneM}}</span></h4>

    </div>
    <div class="col-6">
            {{ $userProfile->phoneA}}
    
        </div>
</div>
</div>
Nov
26
2 months ago
Activity icon

Replied to Not Sure What's Wrong With This

I am really confused on how to fix this? Do I change the validation or the field type in db?

Activity icon

Replied to Not Sure What's Wrong With This

Yes I added value="yes" and value="no"

Activity icon

Replied to Not Sure What's Wrong With This

I changed that but I still get the same error. Is there something I need to change in the controller? I have the field in the db set as boolean

Activity icon

Replied to Not Sure What's Wrong With This

It has to do with the radio buttons but I am not sure how to fix it?

Illuminate\Support\ViewErrorBag {#218 ▼
  #bags: array:1 [▶
    "default" => Illuminate\Support\MessageBag {#219 ▶
      #messages: array:2 [▶
        "grouping" => array:1 [▶
          0 => "The grouping field must be true or false."
        ]
        "instrument" => array:1 [▶
          0 => "The instrument field must be true or false."
        ]
      ]
      #format: ":message"
    }
  ]
}

{"grouping":["The grouping field must be true or false."],"instrument":["The instrument field must be true or false."]} 

Activity icon

Awarded Best Reply on Text Limit

So with the following code below, how do I add it to my existing function?

  class Testimonial extends Model
{
    public function getTestimonialExcerptAttribute()
    {
        return Str::words($this->testimonial, '25');
    }
}
public function index() {
        $posts = Post::all();
        return view('Post.index')
        ->with('posts', $posts);
    }
Activity icon

Started a new Conversation Not Sure What's Wrong With This

I have a multi-auth system that works. But I modified the register page. It worked before I modified it but now when I submit it just goes back to the register page but does not insert in the users table. What am I doing wrong?

<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Register') }}</div>

                <div class="card-body">
                    <form method="POST" action="{{ route('register') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>

                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>

                                @error('name')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                                <label for="address" class="col-md-4 col-form-label text-md-right">{{ __('Address') }}</label>
    
                                <div class="col-md-6">
                                    <input id="address" type="text" class="form-control @error('address') is-invalid @enderror" name="address" value="{{ old('address') }}" required autocomplete="address" autofocus>
    
                                    @error('address')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="form-group row">
                                    <label for="apt#" class="col-md-4 col-form-label text-md-right">{{ __('Apt #') }}</label>
        
                                    <div class="col-md-6">
                                        <input id="apt#" type="text" class="form-control @error('apt#') is-invalid @enderror" name="apt#" value="{{ old('apt#') }}" required autocomplete="apt#" autofocus>
        
                                        @error('apt#')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="form-group row">
                                        <label for="city" class="col-md-4 col-form-label text-md-right">{{ __('City') }}</label>
            
                                        <div class="col-md-6">
                                            <input id="city" type="text" class="form-control @error('name') is-invalid @enderror" name="city" value="{{ old('city') }}" required autocomplete="city" autofocus>
            
                                            @error('city')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                            @enderror
                                        </div>
                                    </div>      
                                    
                                    <div class="form-group row">
                                            <label for="state" class="col-md-4 col-form-label text-md-right">{{ __('State') }}</label>
                
                                            <div class="col-md-6">
                                                <input id="state" type="text" class="form-control @error('state') is-invalid @enderror" name="state" value="{{ old('state') }}" required autocomplete="state" autofocus>
                
                                                @error('state')
                                                    <span class="invalid-feedback" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                                <label for="zipcode" class="col-md-4 col-form-label text-md-right">{{ __('Zipcode') }}</label>
                    
                                                <div class="col-md-6">
                                                    <input id="zipcode" type="text" class="form-control @error('zipcode') is-invalid @enderror" name="zipcode" value="{{ old('zipcode') }}" required autocomplete="zipcode" autofocus>
                    
                                                    @error('zipcode')
                                                        <span class="invalid-feedback" role="alert">
                                                            <strong>{{ $message }}</strong>
                                                        </span>
                                                    @enderror
                                                </div>
                                            </div>

                                            <div class="form-group row">
                                                    <label for="phoneM" class="col-md-4 col-form-label text-md-right">{{ __('Phone (Main)') }}</label>
                        
                                                    <div class="col-md-6">
                                                        <input id="phoneM" type="text" class="form-control @error('phoneM') is-invalid @enderror" name="phoneM" value="{{ old('phoneM') }}" required autocomplete="phoneM" autofocus>
                        
                                                        @error('phoneM')
                                                            <span class="invalid-feedback" role="alert">
                                                                <strong>{{ $message }}</strong>
                                                            </span>
                                                        @enderror
                                                    </div>
                                                </div>


                                                <div class="form-group row">
                                                        <label for="phoneA" class="col-md-4 col-form-label text-md-right">{{ __('Phone (Alt)') }}</label>
                            
                                                        <div class="col-md-6">
                                                            <input id="phoneA" type="text" class="form-control @error('phoneA') is-invalid @enderror" name="phoneA" value="{{ old('phoneA') }}" required autocomplete="phoneA" autofocus>
                            
                                                            @error('phoneA')
                                                                <span class="invalid-feedback" role="alert">
                                                                    <strong>{{ $message }}</strong>
                                                                </span>
                                                            @enderror
                                                        </div>
                                                    </div>     
                                                    <hr class="style-1">  
                                                    
                                                    <div class="form-group row">
                                                            <label for="homechurch" class="col-md-4 col-form-label text-md-right">{{ __('Home Church') }}</label>
                                
                                                            <div class="col-md-6">
                                                                <input id="homechurch" type="text" class="form-control @error('homechurch') is-invalid @enderror" name="homechurch" value="{{ old('homechurch') }}" required autocomplete="homechurch" autofocus>
                                
                                                                @error('homechurch')
                                                                    <span class="invalid-feedback" role="alert">
                                                                        <strong>{{ $message }}</strong>
                                                                    </span>
                                                                @enderror
                                                            </div>
                                                        </div> 

        <div class="form-group row">
                <label for="homechurchcity" class="col-md-4 col-form-label text-md-right">{{ __('Home Church City') }}</label>

                <div class="col-md-6">
                    <input id="homechurchcity" type="text" class="form-control @error('homechurchcity') is-invalid @enderror" name="homechurchcity" value="{{ old('homechurchcity') }}" required autocomplete="homechurchcity" autofocus>

                    @error('homechurchcity')
                        <span class="invalid-feedback" role="alert">
                            <strong>{{ $message }}</strong>
                        </span>
                    @enderror
                </div>
            </div>         
            
            <div class="form-group row">
                    <label for="pastorname" class="col-md-4 col-form-label text-md-right">{{ __('Pastor\'s Name') }}</label>

                    <div class="col-md-6">
                        <input id="pastorname" type="text" class="form-control @error('pastorname') is-invalid @enderror" name="pastorname" value="{{ old('pastorname') }}" required autocomplete="pastorname" autofocus>

                        @error('pastorname')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div> 
             <hr class="style-1">
                <div class="row form-group text-center">
                    <div class="col-4 text-center mx-auto">
                            <label for="grouping" class="col col-form-label text-md-center">{{ __('Currently Grouping?') }}</label>

                            <div class="pretty p-default p-round p-smooth text-center">

                                    <input type="radio" name="grouping" />
                                    <div class="state p-primary">
                                        <label>Yes</label>
                                        </div>
                                </div>
                            
                                <div class="pretty p-icon p-round p-smooth">
                                    <input type="radio" name="grouping" />
                                    <div class="state p-success">
                                        <i class="icon mdi mdi-check"></i>
                                        <label>No</label>
                                    </div>
                                </div>
                    </div>
                    <div class="col-8">
                            <div class="form-group row">
                                    <label for="whenwhere" class="col-md-4 col-form-label text-md-right">{{ __('When/Where?') }}</label>
                
                                    <div class="col-md-6">
                                        <input id="whenwhere" type="text" class="form-control @error('whenwhere') is-invalid @enderror" name="whenwhere" value="{{ old('whenwhere') }}" required autocomplete="whenwhere" autofocus>
                
                                        @error('whenwhere')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div> 

                    </div>
                 
                </div>
       

             <div class="row form-group text-center">
                    <div class="col-4 text-center mx-auto">
                            <label for="instrument" class="col col-form-label text-md-center">{{ __('Do You Play A Musical Instrument?') }}</label>

                            <div class="pretty p-default p-round p-smooth text-center">

                                    <input type="radio" name="instrument" />
                                    <div class="state p-primary">
                                        <label>Yes</label>
                                        </div>
                                </div>
                            
                                <div class="pretty p-icon p-round p-smooth">
                                    <input type="radio" name="instrument" />
                                    <div class="state p-success">
                                        <i class="icon mdi mdi-check"></i>
                                        <label>No</label>
                                    </div>
                                </div>
                    </div>
                    <div class="col-8">
                            <div class="form-group row">
                                    <label for="whichone" class="col-md-4 col-form-label text-md-right">{{ __('Which One(s)?') }}</label>
                
                                    <div class="col-md-6">
                                        <input id="whichone" type="text" class="form-control @error('whichone') is-invalid @enderror" name="whichone" value="{{ old('whichone') }}" required autocomplete="whichone" autofocus>
                
                                        @error('whichone')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div> 

                    </div>
                 
                </div>
                <div class="form-group row">
                        <label for="lastweekendserved" class="col-md-4 col-form-label text-md-right">{{ __('Last Weekend Served') }}</label>
    
                        <div class="col-md-6">
                            <input id="lastweekendserved" type="text" class="form-control @error('lastweekendserved') is-invalid @enderror" name="lastweekendserved" value="{{ old('lastweekendserved') }}" required autocomplete="lastweekendserved" autofocus>
    
                            @error('lastweekendserved')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                    </div> 
                <hr class="style-1">

                        <div class="form-group row">
                            <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">

                                @error('email')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">

                                @error('password')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>

                            <div class="col-md-6">
                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Register') }}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'address' => ['required', 'string', 'max:50'],
            'apt#' => ['required', 'string', 'max:10'],
            'city' => ['required', 'string', 'max:255'],
            'state' => ['required', 'string', 'max:25'],
            'zipcode' => ['required', 'string', 'max:25'],
            'phoneM' => ['required', 'string', 'max:25'],
            'phoneA' => ['required', 'string', 'max:25'],
            'homechurch' => ['required', 'string', 'max:75'],
            'homechurchcity' => ['required', 'string', 'max:255'],
            'pastorname' => ['required', 'string', 'max:255'],
            'grouping' => ['required', 'boolean', 'max:10'],
            'whenwhere' => ['required', 'string', 'max:255'],
            'instrument' => ['required', 'boolean', 'max:10'],
            'whichone' => ['required', 'string', 'max:255'],
            'lastweekendserved' => ['required', 'string', 'max:255'],

            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'address' => $data['address'],
            'apt#' => $data['apt#'],
            'city' => $data['city'],
            'state' => $data['state'],
            'zipcode' => $data['zipcode'],
            'phoneM' => $data['phoneM'],
            'phoneA' => $data['phoneA'],
            'homechurch' => $data['homechurch'],
            'homechurchcity' => $data['homechurchcity'],
            'pastorname' => $data['pastorname'],
            'grouping' => $data['grouping'],
            'whenwhere' => $data['whenwhere'],
            'instrument' => $data['instrument'],
            'whichone' => $data['whichone'],
            'lastweekendserved' => $data['lastweekendserved'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
    }
} 
Nov
14
3 months ago
Activity icon

Replied to Text Limit

So with the following code below, how do I add it to my existing function?

  class Testimonial extends Model
{
    public function getTestimonialExcerptAttribute()
    {
        return Str::words($this->testimonial, '25');
    }
}
public function index() {
        $posts = Post::all();
        return view('Post.index')
        ->with('posts', $posts);
    }
Activity icon

Started a new Conversation Text Limit

I have a function that lists all posts. Everything is working but I would like to limit the word count to 100 and post a read more button for the full article. How would I integrate this to my function?

public function index() {
        $posts = Post::all();
        return view('Post.index')
        ->with('posts', $posts);
    }

Nov
13
3 months ago
Activity icon

Started a new Conversation Add Foreign Key In Migration

I am trying to add a foreign key in my migration and I get the following error: PDOException::("SQLSTATE[HY000]: General error: 1005 Can't create table blog.posts (errno: 150 "Foreign key constraint is incorrectly formed")")

public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('category_id')->unsigned()->index();
            $table->foreign('category_id')->references('id')->on('categories');
            $table->string('title');
            $table->string('author');
            $table->string('image');
            $table->text('short_desc');
            $table->longtext('description');
            $table->timestamps();
        });
    }
Sep
17
5 months ago
Activity icon

Replied to Laravel Update

Thank you for your help. This is what I have now and I am still getting Function Name must be a string. It is highlighting $user->Fname = $request('Fame');

 public function update(Request $request) {
 
 $this->validate($request, [
     'Fname' => '',
     'Lname' => '',
     'email' => '',
 ]);
 
 $user = Auth::user();
 
 $user->Fname = $request('Fame');
 $user->Lname = $request('Lname');
 
 $user->email = $request('email');
 
 
 $user->save();
 
 // $user = User::findOrFail($id);
 //   $user->update(Request::all());
      return view('profile')
                      ->with('success','Product updated successfully');
  }


Activity icon

Replied to Laravel Update

I did that and I get

Undefined variable: request

but if I add

public function update(Request $request)

I get Function name must be a string

Activity icon

Replied to Laravel Update

Route::resource('/profile', 'ManageController');
Route::POST('/profile', '[email protected]')->name('users.update');

Activity icon

Started a new Conversation Laravel Update

I cannot figure out what is happening here: Too few arguments to function App\Http\Controllers\ManageController::update(), 0 passed and exactly 1 expected

What am I doing wrong?

public function update($id) {

 $this->validate($request(), [
     'Fname' => 'required',
     'Lname' => 'required',
     'email' => 'required|email|unique:users',
 ]);

 $user = Auth::user();

 $user->Fname = $request('Fame');
 $user->Lname = $request('Lname');

 $user->email = $request('email');


 $user->save();

 // $user = User::findOrFail($id);
 //   $user->update(Request::all());
      return view('profile')
                      ->with('success','Product updated successfully');
  }
Aug
27
5 months ago
Activity icon

Replied to The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.

I changed everything as below and it still gives me the post error:

Route::get('/#contact', '[email protected]');
Route::post('/#contact', '[email protected]');

And my form to

                <form action="{{url('/#contact')}}" method="post" role="form">
Activity icon

Replied to The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.

Sorry I forgot I changed the Route Yes my routes are like these and it still does not work

Route::get('/#contact', '[email protected]');
Route::post('/#contact', '[email protected]');