我想在Route::resource()控制器中使用自定义函数,比如public function check()、public function login()或public function laogout(),但是我的代码不起作用,如何使用自定义函数?
例如:
路由:
Route::resource('auth', 'AuthenticationController');
查看:
主计长:
public function check()
{
//
}
public function login()
{
//
}
public functio
我使用API资源从VueJs模型返回数据。但是,当我将"with“应用于资源以显式地包含列时,没有任何不同的返回。我根本不能让" with“工作,任何型号、资源,任何东西都行;然而,这在Laravel 8中是很好的。
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$prescriptions = Prescription::paginate(5);
return Prescriptio
web.php
Route:resource('person','PersonController');
// In Actually => Person Data Edit route:get('person/{id}/edit','PersonController@edit');
PersonController.php
public $adressInformation = '';
public function edit($id)
{
$persons = Person::f
在我的控制器中,我添加了EventsResource,在那里我添加了with函数,但是在输出中,它没有执行,或者是一些我无法理解的东西。我增加了输出,请检查一下。这是我的控制器部分。
class EventsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$even
这是我的web.php文件中的路由,它说在路由上找不到404
Route::middleware(["auth"])->group(function () {
Route::resources([
'categories' => CategoryController::class,
'posts' => PostsController::class,
]);
// this is the route i am targeting
Route::delete
我正在我的Linux机器上开发一个离子应用程序,当我运行$ ionic run android时,它会在构建过程中到达:processDebugResources,然后它会错误地显示以下消息
App/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:43:23-37 : AAPT: No resource found that matches the given name (at 'icon' with value '@drawable/icon')
E
我希望(出于项目原因)在类控制器中创建一个数组,并将其传递给资源。考虑一下我的控制器类中的这个方法:
public function getExample(){
$attribute=array('otherInfo'=>'info');
return new ExampleResource($attribute);
}
在我的班上,我会写一些像ExampleResource这样的东西:
public function toArray($request){
return[
'info' => $this->info
]
当我的路线被列出如下时,我会收到一个错误:
resources :coupons
get 'coupons/redeem_coupon', to: 'coupons#redeem_coupon', as: 'redeem_coupon'
错误是:
ActiveRecord::RecordNotFound - Couldn't find Coupon with 'id'=redeem_coupon:
当我将命令倒转到:
get 'coupons/redeem_coupon', to: 'coupons
我使用eloquent从许多表中获取数据,但我没有实现对最后一个表进行排序,而是使用"ordre“而不是"id”。
我的设置:
$etages_lot = EtageLot::where('lot_id', $lot_id)->with('variantes', 'variantes.piece')->get();
EtageLot型号:
public function lot(){
return $this->belongsTo('App\Models\Copro\Lot');
}
p
我有一个表employee_profile,我正在使用这个表来搜索员工,它的列是id,user_id,experience,salary。
我还有两张桌子
employee_keyskills with columns user_id and keyskills_id
employee_preferred_cities with columns user_id and city_id
现在我必须找到使用experience、salary、keyskills[]、salaries[]的员工
只是我需要帮助查找hasMany关联表的结果,这意味着员工应该只过滤指定的keyskills[]和empl
如何使用jquery (不是ajax)提交一个大型表单,而只使用数据(对象或数组)进行简单的post,并在控制器中检索该方法的数据
var index = 0;
var seance = [];
$( "#addSession" ).click(function()
{
var session_name = $('#session_name').val();
var session_description = $('#session_description').val();
var session_lieu = $('#se