Example #1
0
<?php

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $default = ['' => ''];
    $users = $default + MstUser::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    $halls = $default + MstHall::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    $machines = $default + MstMachine::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    $legals = $default + MstLegal::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    $sources = $default + MstOrdersource::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    $contacts = $default + MstOrdercontact::select('id', DB::raw('CONCAT(id, ".", name1) AS name1'))->whereDel(0)->lists('name1', 'id');
    View::share(compact('users', 'halls', 'machines', 'legals', 'sources', 'contacts'));
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
Example #2
0
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::group(['prefix' => 'hiro', 'before' => 'auth'], function () {
    Route::get('', ['as' => 'hiro.index', 'uses' => function () {
        return View::make('main.menu');
    }]);
    Route::get('{mstname}/master', ['as' => 'hiro.master', 'use' => function ($mstname) {
        $url = "http://localhost/sasaki/hiro_manager/master.php?mst=" . $mstname;
        return Redirect::to($url);
    }]);
    Route::post('getlegal', ['as' => 'hiro.getlegal', 'uses' => function () {
        $hallid = Input::only(['hallid']);
        Log::debug($hallid);
        $hall = MstHall::whereId($hallid)->first();
        Log::debug(print_r($hall, true));
        $legal = MstLegal::whereId(print_r($hall['legal'], true))->first();
        Log::debug(print_r($legal, true));
        return Response::json(['name' => $legal['name1']]);
    }]);
    // 中古機管理表
    Route::group(['prefix' => 'oldmanager'], function () {
        Route::get('{id}/edit', ['as' => 'oldmanager.edit', 'uses' => 'OldmanagerController@edit']);
        Route::post('create', ['as' => 'oldmanager.create', 'uses' => 'OldmanagerController@create']);
        Route::post('{id}/update', ['as' => 'oldmanager.update', 'uses' => 'OldmanagerController@update']);
        Route::post('{id}/delete', ['as' => 'oldmanager.delete', 'uses' => 'OldmanagerController@delete']);
        Route::get('list', ['as' => 'oldmanager.list', 'uses' => function () {
            $url = "http://192.168.1.250/hiro_manager/chuukoki/list.php";
            return Redirect::to($url);
        }]);