Voyager: upload data and images location - laravel-5

I just prepared this nice shopping website code
https://github.com/drehimself/laravel-ecommerce-example
I go admin page then upload some new items but
those item data and images are not dislayed.
I tryed to look contoller page but I couldn't find where are at.
Here is the web.php file
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});
Could somebody teach me where should I change?

You can view all routes from
vendor\TCG\Voyager\routes\voyager.php
If you want to override any route then update in web.php

Related

Laravel 9 Route problem return 404 NOT FOUND

I'm trying to render a view but I always get notfoud 404 I don't know how to solve this question anymore if anyone can help me I would be grateful.
any help is welcome.
Thanks in advance.
Everyone have a great Monday.
CommunityPostController -> code ->
public function creategif(Community $community)
{
return view('posts.creategif', compact('community'));
}
Web Routes
Route::get('/', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::get('u/{id}', [App\Http\Controllers\HomeController::class, 'user'])->name('user.view');
Auth::routes(['verify' => true]);
Route::group(['middleware' =>['auth', 'verified']], function (){
Route::resource('communities', \App\Http\Controllers\CommunityController::class);
Route::resource('communities.posts', \App\Http\Controllers\CommunityPostController::class);
Route::resource('posts.comments', \App\Http\Controllers\PostCommentController::class);
Route::get('communities/{community}/posts/creategif', [\App\Http\Controllers\CommunityPostController::class, 'creategif']);
Route::get('posts/{post_id}/vote/{vote}', [\App\Http\Controllers\CommunityPostController::class, 'vote'])->name('post.vote');
});
Views Files Structure
There might be a conflict base on your route order and the image you've posted. As you can see you have resource for your route which in this case this conflict might happen base on route order, and your laravel is actually trying to get a post instead of loading creategif route.
Which in this case every time you try to get access to creategif route, your application is actually trying to load a post base on 'communities.posts' route.
So base on this conflict in your route order, this is working fine and create or any other routes related to 'communities.posts' should work fine, but in other-hand creategif in URL might recognized as a route related to 'communities.posts' resource.
Move your route to top, or in this case just above 'communities.posts' route, don't forget to clear route cache.
Route::group(['middleware' =>['auth', 'verified']], function (){
Route::get('communities/{community}/posts/creategif', [\App\Http\Controllers\CommunityPostController::class, 'creategif']);
Route::resource('communities', \App\Http\Controllers\CommunityController::class);
Route::resource('communities.posts', \App\Http\Controllers\CommunityPostController::class);
Route::resource('posts.comments', \App\Http\Controllers\PostCommentController::class);
Route::get('posts/{post_id}/vote/{vote}', [\App\Http\Controllers\CommunityPostController::class, 'vote'])->name('post.vote');
});

how to link blade.php page to home page option in laravel?

I am a beginner in laravel and have made one frontend page as blade.php
But not getting how to see the output on browser.
Is there any other code which I have to add.
If your blade file has name resources/views/index.blade.php, you need to add this code to file routes/web.php:
Route::get('/', function () {
return view('index');
});

Laravel 5.x Voyager manipulate output bread template edit-add and read

I am trying to manipulate the bread templates of the laravel voyager package. I have to put some new buttons to the templates.
i ve set up a route for the new admin page:
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
Route::get('order-payment-txns', 'AdminController#orderList')->middleware('admin.user');
});
//Controller
public function orderList(){
return view('vendor/tcg/browse-order')
->with("alert", "error.voucher_code_wrong");
}
How could it work with the right dataset?
You are doing so wrong.
copy the original browse, edit-add pages. After that paste to the
Resources\Views\Vendor\Voyager\BREAD NAME
If you dont have voyager folder just create.
"BREAD NAME" section is which page you want to edit. if you want to edit admin\news
Create Resources\Views\Vendor\Voyager\News\browse.blade.php
paste original browse codes in here. Edit it.

Laravel 4.0 Filter and Ajax to load a bootstrap modal pop up

I'm doing a website based laravel 4.2 and Bootstrap. I want a bootstrap modal pop up dialog to load on certain routes provided that the user is not already logged in.
So far i have accomplsihed it to load for the entire application upon loading which is not i want but am in the right direction.
This is my ajax call
script type="text/javascript"> $(document).ready(function() {
$.get("status", function(data, status){
data.status == false ? $('#modal-form').modal({backdrop: 'static'}) : $('#modal-form').modal('hide');
});
});
Status refers to a URL defined in this route
Route::get('/status', 'LoginController#getLoginStatus');
and the method is defined here
public function getLoginStatus()
{
return Response::json(array( 'status' => Sentry::check()));
}
From that, the modal dialog loads on each route across the entire application. I would want to limit the dialog to load on certain routes provided the user is not logged in.
Thing Laravel filter would do the trick for me but i have failed to do so.
Something like
Route::filter('status', function()
{
});
and then the route be like:
Route::get('profile', array('as' => 'submit-profile','before' => 'status','uses' => 'ProfileController#getProfile'));
Thanks guys hope you can give me some advice.
You could use the
Route::currentRouteName()
to check what route your on and then do your preferred action,
like calling the ajax get request for the modal.

Laravel 4: Unable to generate a URL for the named route "login" as such route does not exist

I'm creating an authorization system in my Laravel 4 project. I am trying to use the auth "before" filter.
In my routes.php file, I have:
Route::get('viewer', array('before' => 'auth', function() {
return View::make('lead_viewer');
}));
Route::get('login', 'LoginController');
The before filter calls this line in the filters.php file:
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::route('login');
});
I can manually navigate to my login route. But the auth system isn't letting this happen. I've run composer dump-autoload a couple of times, so that isn't the problem. What am I doing, since I can actually load the login page if I do it manually?
I figure it out. Laravel is looking for a named route: I had to do this:
Route::get('login', array('as' => 'login', function() {
return View::make('login');
}));
An interesting, not very intuitive approach in Laravel. But there must be a reason Taylor did this that I'm not seeing.
To do what you were trying to do in your initial approach you could have just done:
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::to('/login');
});
and it would have worked just fine.
If you want to use named routes then you do what you posted in your answer to your own question. Essentially...more than one way to skin a cat.
Hope that helps
I know you've probably solved this by now but after stumbling across your post while trying to solve a similar problem, I wanted to share my thoughts...
Laravel is NOT looking for a named route for the guest method, it is expecting a path.
Your example works because because the named route and the path are the same i.e. "login". Try changing your URL to something other than 'login' and watch it fail.
If you want to use a named route you should use the route helper method as so...
if (Auth::guest()) return Redirect::guest( route('login') )
Hope that helps someone.

Resources