saeedvir/laravel-routejs is a Laravel package for generate laravel routes for access in javascript.
It currently has 0 GitHub stars and 9 downloads on Packagist.
Install it with composer require saeedvir/laravel-routejs.
Discover more Laravel packages by saeedvir
or browse all Laravel packages to compare alternatives.
Last updated
Generate Laravel Routes For Access Laravel routes from your javascript files.
با استفاده از این پکیج می توانید از همه مسیرهای تعریف شده یا مسیرهایی که مشخص می کنید،دریک فایل جاوااسکریپت خروجی بگیرید و با استفاده از تابع زیر به آنها دسترسی داشته باشید.
composer require saeedvir/laravel-routejs
php artisan vendor:publish --provider="Saeedvir\RouteJs\RoutejsServiceProvider"
edit 'config/routejs.php
<?php
return [
'app_variable'=>'RouteJs',
'js_file'=>public_path('routes.js'), //public/routes.js
'export_all_routes'=>false, // if true then export all routes
'routes'=>[
'user'=>['home'],
'admin'=>['users.index'],
/*'home',
'blog',
'post',
'post.comment',
'list',*/
],
'js_files'=>[
'user'=>'routejs.user.js',
'admin'=>'routejs.admin.js',
],
'append_js'=>'', // for ex : 'var tmp="tmp_value";console.log(tmp);'
];
then
php artisan route:export-js
and
<script src="routes.js"></script>
alert(route('post',{id:23}))
//Route::get('/Blog-Page',function(){})->name('blog');
route('blog',{});
//return /Blog-Page
//Route::get('/Blog-Page',function(){})->name('blog');
route('blog',{order:'new'});
//return /Blog-Page?sord=new
//Route::get('/Blog-Page/{id}',function(){})->name('post');
route('post',{id:12});
//return /Blog-Page/12
//Route::get('/Blog-Page/{id}/comment/{comment_id}',function(){})->name('post.comment');
route('post.comment',{id:12,comment_id:8});
//return /Blog-Page/12/comment/8