-
-
Notifications
You must be signed in to change notification settings - Fork 93
Utility & Helpers
Asep edited this page Apr 3, 2022
·
1 revision
Get Ladmin Pacakge version
ladmin()->version()
Get the user class that has been set in the config file.
ladmin()->admin()
#----- OR -----
ladmin()->user()
All routes that enter the ladmin module, must be in this function.
ladmin()->route( function() {
/**
* All routes listed here are accessible
* on the Administrator page
* http://localhost:8000/administrator/article
*/
});
/**
* All routes listed here, can be accessed
* outside the Administrator page
* * http://localhost:8000/blog
*/
To display the back button on the page, it is must add a back parameter in each url such as
route('ladmin.blog.show', ['uuid', 'back' => 'http://url-target.test'])
You can also write it like below.
ladmin()->back( ? Array )
If in route
it will be like below.
route('ladmin.blog.show', ladmin()->back(['uuid', 'page' => 1]))
Then the output of the function can be seen below.
http://localhost:8000/blog/uuid-uuid-uuid?page=1&back=http://current-url.test
Inside each controller it is necessary to add the below function, to give access by Role to each admin user.
ladmin()->allows(['name.of.gate.in.menu.class'])
For example in controller
create
can be seen below.
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
ladmin()->allows(['article.can.create']);
return view('blog::article.create');
}
The function below serves to retrieve the path of each module.
module_path('Blog')
If you use uuid in this project, you can use the provided trait, please add it to each model that has the uuid attribute.
. . .
use Illuminate\Database\Eloquent\Model;
use Hexters\Ladmin\UuidGenerator;
. . .
class Article extends Model
{
use HasFactory, UuidGenerator;
. . .
- #1 Create Module
- #2 Create Menu
- #3 Route
- #4 Create DataTables
- #5 Template Layout
- #6 Create Model
- #7 Create Command
- #8 Create Component
- #9 Broadcast Notification
- #10 Group Search
- #11 Flashing Message
- #12 Compiling Assets (ViteJs)
- #13 Ladmin Option
- #14 Utility & Helpers
- #15 Vendor Publish
- #16 Custom Style
- #17 Ladmin Awesome
- #18 Make Money