Esempio n. 1
0
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
function rand_str()
{
    return hash('sha256', substr(str_shuffle(sha1(rand(0, 999999999))), 0, rand(20, 45)));
}
Route::group(['middleware' => ['web']], function () {
    Route::get('/', function () {
        $top_projects = App\Project::limit(6)->orderBy('total_pledged', 'desc')->get();
        return view('welcome', compact('top_projects'));
    });
    Route::get('/about', function () {
        return view('about');
    });
    Route::group(['prefix' => 'account', 'middleware' => 'auth'], function () {
        Route::get('/', function (Request $r) {
            $user_pledges = $r->user()->u_pledges()->with('project')->get();
            $user = auth()->user();
            return view('account', compact('user_pledges', 'user'));
        });
    });
    Route::group(['prefix' => 'wallet'], function () {
        Route::post('withdraw', 'WalletController@withdraw');
        Route::get('generate', 'WalletController@generate');