artisticre

artisticre

Member Since 1 Year Ago

Experience Points
4,340
Total
Experience

660 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 1
4,340 XP
Nov
14
5 days 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
6 days 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
2 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
2 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]');
Activity icon

Started a new Conversation The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.

My Form

<section id="contact">
    
        <div class="container text-center">
            @if (Session::has('flash_message'))
        <div class="alert alert-primary" role="alert">
            This is a primary alert—check it out!
          </div>
 @endif
          <div class="row">
            <div class="col-12 m-t-75">
              <h1 class="abouttitle">Contact Us</h1>
               
            </div>
          </div>
          <div class="row m-t-30">
            <div class="col">
                <form action="{{url('/#contact')}}" method="PUT" role="form">
                    {{csrf_field()}}
                   <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <input type="text" name="name" class="form-control" placeholder="Your Name *" value="" />
                                @if ($errors->has('name'))
                      <p class="help is-danger">{{$errors->first('name')}}</p>
                      @endif
                              </div>
                              
                            <div class="form-group">
                                <input type="text" name="email" class="form-control" placeholder="Your Email *" value="" />
                            </div>
                            <div class="form-group">
                                <input type="text" name="phone" class="form-control" placeholder="Your Phone Number *" value="" />
                            </div>
                            <div class="form-group">
                                <input type="submit" name="submit" class="btnContact" value="Send Message" />
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <textarea name="message" class="form-control" placeholder="Your Message *" style="width: 100%; height: 150px;"></textarea>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            
          </div>
        </div>
        
        </section>
        

My Routes

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

My Controller

public function getContact()
    {
      return view('/#contact');
    }

    public function postContact(Request $request)
            {
            $this->validate($request, [
              'name' => 'required',
              'email' => 'required|email',
              'phone' => 'required',
              'message' => 'required'
            ]);
              $data = array(
                  'name' => $request->name,
                  'email' => $request->email,
                  'phone' => $request->phone,
                  'subject' => $request->subject,
                  'msg' => $request->message 
              );
            
            
            Mail::send('emails.contact', $data, function($message) use ($data) {
                $message->from($data['email']);
                $message->to('[email protected]');
                $message->subject($data['subject']);
            });
            Session::flash('success', 'Your Email was Sent!');

            return redirect('/#contact');
        }
May
30
5 months ago
Activity icon

Started a new Conversation Suggestion About Page Creation?

I am looking for a way with Laravel that I can have admin users create pages on the fly with text and images. What would be the best way to go about doing this?

May
22
5 months ago
Activity icon

Replied to Help With This Code

How would I hide it in the blade? I know if !exist it shows button how would I write the else hide?

Activity icon

Started a new Conversation Help With This Code

This code was working. It checks to see if a record exists. If it doesn't, it displays a button that says start application. If there is, it displays view/print button. As of now it does display the start application if no record but when there is a record, it displays the view/print button but the start application button is still there. Not sure why.

My Controller

public function viewprint()
        {
           $userID = Auth::user()->id;
          $viewlist = DB::table('employmentapplication')
        ->select('id', 'userID')
        ->where('employmentapplication.userID', '=', $userID)
           ->get();
       $exists =  DB::table('employmentapplication')
             ->select('id')
             ->where('employmentapplication.id', '=', $userID)->exists();
     return view('home')->with(compact('viewlist','exists'));
       }

My Blade View

 @if ( ! $exists)

                                                      <a class="btn btn-warning m-l-10 m-t-30 m-r-10" href="{{url('application/employment-application')}}">Start Application</a>
                                                  @endif
                                              
                                                  @foreach($viewlist as $pair)

                                            <a class="btn btn-primary btn-md m-t-30 m-l-10 m-r-10" href="/application/applicationreport?id={{$pair->id}}" target="_blank">View</a>

                                            <a class="btn btn-success m-t-30 m-r-10" href="/application/applicationreportprint?id={{$pair->id}}" taget="_blank">Print</a>


                                            @endforeach
May
20
5 months ago
Activity icon

Started a new Conversation Eloquent Laravel

I am going through a tutorial on eloquent and I have this store function created. My question is how do I have that data print to a success view after submit?

public function store(Request $request)
    {
        $this->validate($request, [
           'name' => 'required',
           'phone' => 'required',
           'email' => 'required',
           'message' => 'required'
           ]);
           $contact = new Contact;
           $contact->name = $request->input('name');
           $contact->phone = $request->input('phone');
           $contact->email = $request->input('email');
           $contact->message = $request->input('message');
           $contact->save();
     
       return redirect('contact/success')->with(compact('contact'))->with('success', 'Your Message Has Been Submitted');
    }