Example #1
0
 public function postImage($id, Request $request, Driver $drivers, ImageUploader $image)
 {
     $model = $drivers->findOrFail($id);
     return $image->saveImage($model, $request->get('main_image'));
     $this->validate($request, ['main_image' => 'required|image|max:5000']);
     return $request->all();
 }
Example #2
0
    /**
     * ===========================================================
     * Contacts
     */
    Route::get('contacts/search', ['as' => 'admin.contacts.search', 'uses' => 'ContactsController@search']);
    Route::post('contacts/image/{id}', ['as' => 'admin.contacts.image', 'uses' => 'ContactsController@postImage']);
    Route::bind('contacts', function ($id) {
        return App\Contact::whereUserId(auth()->user()->id)->findOrFail($id);
    });
    Route::resource('contacts', 'ContactsController', []);
    /**
     * Drivers
     */
    Route::get('drivers/birthdays', ['as' => 'admin.drivers.birthdays', 'uses' => 'DriversController@birthdays']);
    Route::get('drivers/search', ['as' => 'admin.drivers.search', 'uses' => 'DriversController@search']);
    Route::post('drivers/image/{id}', ['as' => 'admin.drivers.image', 'uses' => 'DriversController@postImage']);
    Route::bind('drivers', function ($id) {
        return \App\Driver::findOrFail($id);
    });
    Route::resource('drivers', 'DriversController');
    /**
     * Todos
     */
    Route::get('todos/completar/{id}', ['as' => 'admin.todos.completar', 'uses' => 'TodosController@completar']);
    Route::get('todos/incompletar/{id}', ['as' => 'admin.todos.incompletar', 'uses' => 'TodosController@incompletar']);
    Route::delete('todos/remove_done_tasks', ['as' => 'admin.todos.remove_done_tasks', 'uses' => 'TodosController@removeDoneTasks']);
    Route::bind("todos", function ($id) {
        return \App\Todo::whereUserId(Auth::user()->id)->findOrFail($id);
    });
    Route::resource('todos', 'TodosController', []);
});