Member Since 1 Year Ago
4,930 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
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?
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')}}"
});
Replied to Token Is Invalid
Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given
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
Replied to 405 (Method Not Allowed) In Laravel Ajax Request
Solved with this line:
url: "{{ route('admin.faculty.store')}}",
Replied to 405 (Method Not Allowed) In Laravel Ajax Request
@marianomoreyra, Yes. Route is correct with admin.
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?
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?
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??
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
Okay. But what about the Passing data to Controller? From my solution I can pass parameter as much as I want.
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;
}
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;
}
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
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.
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
Yes.
I am not using any view
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.
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!
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??
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??
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
That was an Example to clear my Requirement.
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
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!!
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
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']
);
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
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
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
public function holiday(Request $request) {
return $request->name;
}
I have to pass that name!
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
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?
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
If I use POST
then is there any way?
Replied to How To Pass Data To Controller In Laravel From Route: Laravel 8
I know this the way, But I don't want to pass this with Parameter. I want to create data inside this.
Thanks
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
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?
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?