Skip to content
Advertisement

Laravel Action Route not Define

I have unique problem. I already create Route on web.php, on Controller, and Blade. and working on my localhost. but after publish to real server, I jus got error Action urlcontroller@function not define. this is my code.

Route::get('/timetableschedule', 'ManagementController@EmployeeTimeTable');

this is my web.php

public function EmployeeTimeTable(Request $request){
    $session = $request->session()->get('user.id');
    $companysession = $request->session()->get('user.location');
    $locationdata = DB::table('company')
    ->join('companyrole','companyrole.company_id','=','company.Company_id')
    ->join('users','users.id','=','companyrole.user_id')
    ->where('users.id',$session)
    ->get();

    $userlist = db::table('users')
    ->join('companyrole','users.id','companyrole.user_id')
    ->where('companyrole.company_id',$companysession)
    ->whereNotNull('users.NPK')
    ->select('users.id','users.name','users.NPK')
    ->orderby('users.name')
    ->get();

    $timesetting = db::table('time_leaving')
    ->where('company_id',$companysession)
    ->get();

    $leaveschedule = db::table('employee_leaving')
    ->join('users','employee_leaving.user_id','users.id')
    ->where('employee_leaving.company_id',$companysession)
    ->select('employee_leaving.leaving_date','users.name')
    ->get();

    return view('Management.employeetimetable',['location'=>$locationdata,'UserList'=>$userlist,'ListTimeSet'=>$timesetting,'LeavingSchedule'=>$leaveschedule]);
}

this is my controller

<li>
          <a href="{{action('ManagementController@EmployeeTimeTable')}}" class="dropdown-item">
            <p>Employee Timetable</p>
          </a>
        </li>

and this is code on blade to call controller@function

this step same as another controller, web, and blade.php. but, just for this rout get me a trouble. thank you

Advertisement

Answer

You have a problem with your route cache, simply do this:

php artisan cache:clear

php artisan route:cache

if you want to do same on the server you can define a route in web.php for that like this:

Route::get('/clear/route', 'ConfigController@clearRoute');

and make ConfigController.php like this

class ConfigController extends Controller
{
    public function clearRoute()
    {
        Artisan::call('route:clear');
    }
}

and then go to that route on server example http://your-domain/clear/route

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement