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

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.

Related

Laravel 9 Inertia pagination use correct base url with port

I'm using Laravel 9 with Inertia and VueJs. I'm trying to paginate my invoices, and the links display as expected when I load the page (http://localhost:3000). However, when I click on a button to go to the next page (or any other page from the pagination), all the links change to:http://localhost/. I don't know how to solve this.
InvoiceController
$invoices = Invoice::latest()
->with('customer:id,name')
->orderByDesc('invoice_date')
->paginate(10);
return Inertia::render('Invoices', ["invoices" => $invoices]);
.env
APP_URL=http://localhost:3000
DEV_URL=http://localhost:3000
webpack.mix.js
// ...
.browserSync("localhost");
config/app.php
'url' => env('APP_URL', 'http://localhost:3000'),
Update
A github issue is opened: https://github.com/inertiajs/inertia/issues/811

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');
});

how can i make 4 links to a controller?

i'm setting up a new project in my laravel
The stuffs i have :
1- PostsController
2- Post model
3- Routes:resource('posts','PostsController')
4- after i login i have a create button for post create
after click on it i have below image :
My desire:
i want without changing whole project or whole routes resources have these :
after i login i want to have 4 boxes like this( i made it )
with this property :
after i click any of them i can create post according to their type
for example if i click on video content i enter to a page with 2 form:
like title video and upload video
after i click on text content i enter to page like the image i showed
you at the first
it means if i click on video content, resource route take me to create method in postscontroller and create method check if i came from content video link
return view (posts.create_video) or if i came from sound content link box return view(posts.content_sound) and etc boxes
how can i do all of that please help me thanks
You could structure it as following:
[routes/web.php]
Route::get('posts/create/{type}', 'PostController#create')->name('posts.create');
Route::resource('posts', 'PostController')->except(['create']);
[PostController]
class PostController extends Controller
{
public function create($type)
{
if (in_array($type, ['sound', 'video', 'image', 'text'])) {
return view("posts.content_{$type}");
}
abort(404);
}
}

Voyager: upload data and images location

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

Why creating a route with angular-fullstack creates a component?

Im using angular-fullstack newest version I think "generatorVersion": "3.7.5", and right now I created a route
yo angular-fullstack:controller products and it created the files:
products.controller.js
products.controller.spec.js
products.js
products.scss
and when I tried
yo angular-fullstack:controller product_new_view
inside the folder /client/app/products it created a new folder
/client/app/products/product_new_view
which I think is ok but the question is why the controller definition is not inside a component as in /client/app/products/products.controller.js
angular.module('meanshopApp')
.component('products', {
templateUrl: 'app/products/templates/products.html',
controller: ProductsComponent
})
})();
instead is just
angular.module('meanshopApp')
.controller('ProductNewViewCtrl', function ($scope) {
$scope.message = 'Hello';
});
does that mean that for every new view I need to create a route? cause I read https://docs.angularjs.org/guide/component and there it says
Components as route templates
Components are also useful as route templates (e.g. when using ngRoute). In a component-based application, every view is a component:
Im new to angular by the way

Resources