Is there some way to use already created database table in voyager? - laravel

I am using voyager to create admin panel for my app. Link for voyager is https://github.com/the-control-group/voyager. I need to use already created database tables which I created in phpmyadmin but can not find way to do so. Voyager gives some already built tables like categories, menus, pages etc. and also let us create new tables but how can I use my own created tables which I created in phpmyadmin?

Its possible use your owns tables, inside bread section should appear the option to make bread of it.
To make a bread of a table you should create the model of that table, if you have the table "articles" you can create the model with "php artisan make:model article"

Related

Change model And database table name in Laravel

I want to change my model name and its database table name in a Laravel project, but I've connected other models with relationships. So now I want to know if there is any way or artisan command to change it, so it does not make problems for its connection?

Do i need to create migration in Laravel for already exist tables in database?

I'm new in Laravel world!
I created a Database in MySql with 8 Tables!
now i just want to know that do I need to create Migration for all 8 tables?
or just need to create model for each table?
It is up to you. If you don't need migration for those tables (ie. for testing/seeding, migration to another database or creating new local setup), then it is not necessary.
Also models are not required but if you want to use Eloquent and other fancy Laravel things, then create them.
From my point of view there is no reason to not have migrations and models.

Getting CRUD data from laravel backpack to a new blade view page

I'm new to laravel backpack so what did is created a CRUD of title and description. And everything in admin panel works fine, but now I need to get that data to another blade view file through a controller like in a vanilla laravel but I cant seem to find how to do it.
If I understand your question correctly, there's absolutely NOTHING special you need to do - just do it "the normal Laravel way", by using your Model to query the database. It's usually something like Career::all() or Career::find($id) or Career::where('something', $value)->get(), depending on what you need to fetch from the database.
That's because Backpack uses your existing Eloquent Models, or creates the models if you don't have them already (usually in app\Models). So whenever you create/edit/delete an entry using the Backpack interface (aka CRUD), what Backpack does is use that Model to interact with the database. If you want to interact with the database, you should do the same thing - use the Model. That's the expected and recommended way of doing things in Laravel. To have Models for all your major database tables and do most (or all) of your interactions with the database using the Eloquent Models.
You can use view like this:
view('crud::show');
list, create etc.
all available files, you can find here: vendor/backpack/crud/src/resources/views/crud
If you want to override the template, please copy vendor template to your project
vendor/backpack/crud/src/resources/views/crud/show.blade.php > resources/views/vendor/backpack/crud/show.blade.php

How to show data as per users in Voyager Laravel

Voyager is one of the most efficient admin panel for laravel. But, here I am trapped in a typical situation. For example, I am using this admin panel for booking appointment. I want the admin to view all the records but the user to view, edit, delete only the records which he had added. I can insert my own Page there but that will increase the work as I have to create my own add, edit, and delete functionality along with the view. I just want to know the place where the data is fetched from database to display on the view page so that as per the login user I could manipulate it.
To achieve this:
You need to add policy to your bread php artisan make:policy PostPolicy
Inside the policy you can specify who can edit what depending on your logic

Laravel Voyager-Deletion of table fields does not delete from view

I am working on a very simple web application and managing admin panel using Laravel Voyager Version: 1.1 and Laravel Version 5.7.
I have created Courses table using Voyager database tool. There is a column by the name of tutor_id in Courses table.
It was working fine but after few days due to application requirements I have deleted that “tutor_id” column from "Courses" table using Voyager. The column has successfully deleted from table which I can see by going to phpMyAdmin.
The issue is that when I browse Courses the tutor_id column is still present there as shown in the figure.
I have cleared the cache but have no luck.
1) go to table data_types and find id of "Courses" table
2) go to table data_rows and find "tutor_id" row and delete it

Resources