public function postRegister() { $rules = ['email' => 'required|email', 'ngo-name' => 'required|min:5', 'ngo-desc' => 'string|min:20', 'ngo-email' => 'required|email', 'ngo-phone' => 'required|min:7']; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return redirect('/envy/auth/register')->withErrors($validator)->withInput(); } else { $user = User::where('user_email', Input::get('email'))->first(); if ($user && !$user->is_user_ngo) { $user->is_user_ngo = true; $user->save(); $ngo = new Ngo(); $ngo->user_id = $user->user_id; $ngo->ngo_name = Input::get('ngo-name'); $ngo->ngo_email = Input::get('ngo-email'); $ngo->ngo_phone = Input::get('ngo-phone'); $ngo->ngo_description = Input::get('ngo-desc'); $ngo->save(); } // $user = new User; // $user->user_name = Input::get('name'); // $user->user_email = Input::get('email'); // $user->password = Hash::make(Input::get('password')); // $user->is_user_ngo = true; // $user->save(); return redirect('/envy/auth/login'); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement("SET foreign_key_checks = 0"); Message::truncate(); DB::statement("SET foreign_key_checks = 1"); $date = (new DateTime())->format('Y-m-d H:i:s'); $ngo = Ngo::where('ngo_email', '*****@*****.**')->get()->first(); Message::create(['user_id' => $ngo->user_id, 'sender' => 'f****r', 'message_subject' => 'Good Work.', 'message_body' => 'Loving you work. To Minus Z. ORG', 'sent_date' => $date]); // $ngo = Ngo::where('ngo_email', '*****@*****.**')->get()->first(); // Message::create([ // 'user_id' => $ngo->user_id, // 'sender' => 'chibi_loli', // 'message_subject' => 'Mooo.', // 'message_body' => 'Don\'t get the wrong idea. DoubleA.', // 'sent_date' => $date // ]); }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement("SET foreign_key_checks = 0"); Ngo::truncate(); DB::statement("SET foreign_key_checks = 1"); // $user = User::where('user_name', '=', 'frodo')->get()->first(); // Ngo::create([ // 'user_id' => $user->user_id, // 'ngo_name' => 'Double A. ORG', // 'ngo_email' => '*****@*****.**', // 'ngo_phone' => '+923237455131', // 'ngo_image' => 'ngo image here.', // 'ngo_cover' => 'ngo cover image here.', // 'ngo_description' => 'this non-profit origanization is actually dummy.' // ]); $user = User::where('user_name', '=', 'bilbo')->get()->first(); Ngo::create(['user_id' => $user->user_id, 'ngo_name' => 'Minus Z. ORG', 'ngo_email' => '*****@*****.**', 'ngo_phone' => '+923234545554', 'ngo_image' => 'zee image here.', 'ngo_cover' => 'ngo zee cover image here.', 'ngo_description' => 'this non-profit origanization is actually zee.']); }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement("SET foreign_key_checks = 0"); Cause::truncate(); DB::statement("SET foreign_key_checks = 1"); // $ngo = Ngo::where('ngo_name', 'Double A. ORG')->get()->first(); // Cause::create([ // 'user_id' => $ngo->user_id, // 'cause_title' => 'EarthQuake PK', // 'cause_venue' => 'ISLAMABAD', // 'cause_cover' => 'Optimal cover for cause.', // 'cause_description' => 'Raising fund for PK earthquake.' // ]); // Cause::create([ // 'user_id' => $ngo->user_id, // 'cause_title' => 'Flood Donation PK', // 'cause_venue' => 'LAHORE', // 'cause_cover' => 'Optimal cover for flood water.', // 'cause_description' => 'Raising fund for Flood prevention.' // ]); $ngo = Ngo::where('ngo_name', 'Minus Z. ORG')->get()->first(); Cause::create(['user_id' => $ngo->user_id, 'cause_title' => 'Child Support', 'cause_venue' => 'United Kingdom', 'cause_cover' => 'cover image for child', 'cause_description' => 'Raising fund for supporting child.']); Cause::create(['user_id' => $ngo->user_id, 'cause_title' => 'Liberation of minor sex', 'cause_venue' => 'Burma', 'cause_cover' => 'Burma cover image', 'cause_description' => 'Transport service for minorities.']); }
use App\Ngo; use App\Cause; use App\Item; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::bind('ngo', function ($value) { return Ngo::where('user_id', $value)->first(); }); Route::bind('cause', function ($value) { return Cause::where('cause_id', $value)->first(); }); Route::bind('item', function ($value) { return Item::where('item_id', $value)->first(); }); Route::get('/', 'NgoController@index'); Route::get('/{ngo}', 'NgoController@ngoView'); Route::get('/cause/{cause}', 'NgoController@causeView'); Route::get('/causes/all', 'NgoController@viewAll'); Route::get('/{ngo}/contact-us', 'NgoController@contactView'); Route::post('/{ngo}/contact-us/message', 'NgoController@storeMessage'); Route::get('/auth/login', 'MyAuthController@getLogin'); // Route::get('/auth/login', 'MyAuthController@getLogin');
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $ngos = Ngo::all(); return view('ngos.index', ['ngos' => $ngos]); }