mrperfectionist

Member Since 1 Year Ago

Experience Points
5,070
Total
Experience

4,930 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
1
Lessons
Completed
Best Reply Awards
5
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

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

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 2
5,070 XP
Feb
06
3 weeks ago
Activity icon

Started a new Conversation How To Register New ServiceProvider In Live Server?

I have a live project in Laravel.

After adding new package, I will add it in Live Server.

What I have to do for it??

Which files I have to add in Live?

Jan
07
1 month ago
Activity icon

Started a new Conversation How To Pass Id For Update In Laravel

I am using Resource Controller.

During ajax Update how will I pass id?

var id = $("#ID").val();
$.ajax({
   url: "{{ route('admin.department.update')}}"
});
Dec
20
2 months ago
Activity icon

Replied to Token Is Invalid

Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given

Activity icon

Started a new Conversation Token Is Invalid

Login, Registration is working well. But problem is when I am trying to create a Product Entry in Database.

This is my code:

addProduct() {
           let uri = 'http://localhost:8000/api/auth/product';
           let token = localStorage.getItem('token')
           
            this.axios.post(uri, {
                headers: {
                    Authorization: 'Bearer ' + localStorage.getItem('token')
                },
                token: 'Bearer ' + localStorage.getItem('token'),
                data: this.product
            }).then((response) => {
                console.log("Success: ", response.data)
            }).catch( (err) => {
                console.log("Error: ", err.response.data.errors)
            });
        },

Giving me various error:

Token is invalide

and

Token is not provided

Dec
01
2 months ago
Activity icon

Replied to 405 (Method Not Allowed) In Laravel Ajax Request

Solved with this line:

url: "{{ route('admin.faculty.store')}}",
Activity icon

Replied to 405 (Method Not Allowed) In Laravel Ajax Request

@marianomoreyra, Yes. Route is correct with admin.

Activity icon

Started a new Conversation 405 (Method Not Allowed) In Laravel Ajax Request

<form>
-----
</form>

Ajax Request:

var data = $(form).serializeArray();
data.push({ name: "faculty_tab_image", value: inputImage });

$.ajax({
            url: '/admin/faculty/store',
            type: 'POST',
            data: { data, _token: _token },
            success: function(response) {
                console.log(response);
            },
            error: function(error) {
                console.log(error);
            }
})

Route:

Route::resource('faculty', 'FacultyTabsController');

Controller Method:

public function store(Request $request)
{
    return 'YES';
}

What is the problem?

Nov
30
2 months ago
Activity icon

Started a new Conversation How To Validate Rich Text Validation In Laravel

I am using Quill Rich Textbox for writing Description.

<div id="faculty_tab_description" class="ql-scroll-y" style="height: 300px;">
    
</div>

It's just a div.

How can I validate it is empty of not in controller?

Nov
16
3 months ago
Activity icon

Started a new Conversation Message: "CSRF Token Mismatch." Laravel

I have no form in blade. I am making an ajax request from jQuery.

  var answer = parts[parts.length - 1];

     // Ajax Setup

    $.ajaxSetup({
           headers: {
                 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
    });
                
    // ajax call to delete that image from Database and Local Storage
    $.ajax({
          type: 'POST',
         url: '/admin/event/'+answer,
         data: {
               _token: '{{ csrf_token() }}'
         },
         success: function(res) {
              console.log(res);
         },
         error: function(error) {
               console.log(error);
         }
  })

web.php

Route::post('/event/{image_name}', '[email protected]');

HomeEventsController:

public function deleteEventImage($eventImageName)
{
        $msg = "This is a simple message.";
        return response()->json(array('Image'=> $eventImageName), 200);
 }

Giving me the error: CSRF token mismatch.

What is the problem??

Oct
09
4 months ago
Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@snapey,

Okay. But what about the Passing data to Controller? From my solution I can pass parameter as much as I want.

Activity icon

Awarded Best Reply on How To Pass Data To Controller In Laravel From Route: Laravel 8

Hello Seniors,

How about my Solution?

Is it okay? It's giving me my desired Result.

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route;

Route::get('/', function(){
    $data = "Name";
    return App::call('App\Http\Controllers\[email protected]' , ['data' => $data]);
});

DateController:

public function holiday($data) {
        echo $data;
}
Oct
07
4 months ago
Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

Hello Seniors,

How about my Solution?

Is it okay? It's giving me my desired Result.

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route;

Route::get('/', function(){
    $data = "Name";
    return App::call('App\Http\Controllers\[email protected]' , ['data' => $data]);
});

DateController:

public function holiday($data) {
        echo $data;
}
Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

I am not going to use it.

@jlrdw gave me correct Answer. But I am not so much expert to start with Laravel Scratch. So, I started with PHP Practitioner and OOP PHP Course of Laracast. Then I will dive on that.

By the way, Still finding the answer......................... Want to call a Class onload Laravel App.

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

Trying to solve a problem which will accept one Request and output one file.

With that Request I want call a Class Function which will accept one/two parameters and give me file output with that name.

This is the problem.

Now, with a Request how will I call a Class which will accept parameter and giving me a file output.

This is my problem which trying to solve.

So, I am trying to Call a Controller Class Function with my parameter from Route.

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

:-( :-( :-(

Because I am not getting way to do that!!!

Thank you for your help.

Let me think in another way!

Finally it's not possible to pass data in this way!

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

Okay.

Then forgot about Route.

Is it possible to Call a Controller from index.php file??

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

Okay.

Again describing!!

While I will go to this URL ('/') my laravel Application it will show me a Name.

For this purpose, I don't want to load Any view.

Just with my root URL i want pass a Name to a Controller.

While we run a Fresh Laravel Solution, it show me welcome.blade.php file. Because in our Route we declare it to load, Right??

I want to load just a Controller Method with a Name Variable which I want to pass from Route.

Clear??

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

That was an Example to clear my Requirement.

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@automica,

Yes, I want to get just data not the view.

@jlrdw,

It's giving me NULL value.

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

I have tried with this:

public function holiday(Request $request) {
        return $request->all();
}

Route:

Route::get('/',
    [DateController::class, 'holiday'],
    ['name' => 'Taylor']
);

It is not giving any Error. But giving me an empty Array!!

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

Please see this example:

Route::view('/',
    'welcome',
    ['name' => 'Taylor']
);

I can return a view directly with a name variable. Here, without return a view, I want to get just to call a controller function with the name variable.

Now clear to you? For Example:

Route::get('/',
    [UserController::class, 'index'],
    ['name' => 'Taylor']
);
Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@jlrdw,

Okay.

With Ajax call we can pass data to Controller. But I don't want to take any help of View. Want to pass a variable from Route to Controller.

Thanks

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

Sorry. It's a mistake.

It will be "FIXED name variable"

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

public function holiday(Request $request) {
   return $request->name;
}

I have to pass that name!

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

Okay, Let me describe in details.

While I will browse / route then a Controller Function suppose holiday() will call. I don't want to pass anything from View. But I need to pass a FIXED name variable to my holiday() function.

After some calculation this function will give me a data. That's not a problem.

Got the point?

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@snapey,

public function holiday(Request $request) {
        return $request->all();
}

Not Working!

Activity icon

Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8

@michaloravec,

I know this the way, But I don't want to pass this with Parameter. I want to create data inside this.

Thanks

Activity icon

Started a new Conversation How To Pass Data To Controller In Laravel From Route: Laravel 8

I have a Controller named: DateController which as a Method holiday()

I want to pass an Object to this holiday() method:

Route::get('/',
    [
        data: {
           'name' => 'Mr. Perfectionist'
        },
        DateController::class, 'holiday'
    ]
);

I just want to print it like this:

public function holiday($name) {
        return $name;
}

Giving Error:

ReflectionException Function () does not exist

Sep
21
5 months ago
Activity icon

Started a new Conversation Why Just One Component Is Showing In Laravel 7 & Vuejs

App.js:

require('./bootstrap');

window.Vue = require('vue');

Vue.component('app-navbar', require('./components/snippets/AppNavbar.vue').default);
Vue.component('app-footer', require('./components/snippets/AppFooter.vue').default);

const app = new Vue({
    el: '#app',
    router
});

welcome.blade.php

<div id="app">
       <app-navbar />
      <router-view></router-view>
      <app-footer />
</div>

web.php

Route::get('{any}', function () {
    return view('welcome');
})->where('any', '.*');

Here just AppNavbar Component is showing. But AppFooter is not showing. What I missed?

Sep
02
5 months ago
Activity icon

Started a new Conversation Uncaught TypeError: Object(...) Is Not A Function

While I am going to add Vue Router it is giving me this error and router-link is not working!

There is an Warning in Console:

[Vue warn]: Failed to resolve component: router-link 
  at <NavBar> 
  at <App>

src/router/index.js

import { VueRouter } from 'vue-router'
import Category from '../components/Category.vue';
import Post from '../components/Post.vue';


const router = new VueRouter({
    routes: [
      {
        path: '/post',
        component: Post
      }
    ]
})

export default router

main.js file:

import { createApp } from 'vue'
import App from './App.vue'
// Routes
import router from './router/index.js'

const app = createApp(App)
app.use(router);
app.mount('#app')

Navbar:

<nav class="navbar">
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
        <div class="navbar-nav">
          <router-link to="/" class="nav-item nav-link">Post</router-link>
          <router-link to="/category" class="nav-item nav-link">Category</router-link>
        </div>
    </div>
</nav>

What is the problem?