public function causeView(Cause $cause)
 {
     // $items = Item::where('cause_id', $cause->cause_id)->get();
     // $ngo = Ngo::where('user_id', $cause->user_id)->first();
     $cause = Cause::where('cause_id', $cause->cause_id)->first();
     return view('ngos.causeView', ['cause' => $cause]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     Item::truncate();
     DB::statement("SET foreign_key_checks = 1");
     $cause = Cause::where('cause_title', 'Liberation of minor sex')->get()->first();
     Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'blanket', 'item_description' => 'for minor sex', 'item_required' => 20, 'item_received' => 7, 'item_worth' => 11]);
     Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'bedsheets', 'item_description' => 'for minor sex', 'item_required' => 45, 'item_received' => 23, 'item_worth' => 9]);
     $cause = Cause::where('cause_title', 'Child Support')->get()->first();
     Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'books', 'item_description' => 'for child support', 'item_required' => 200, 'item_received' => 159, 'item_worth' => 14]);
     Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'desks', 'item_description' => 'for child support', 'item_required' => 100, 'item_received' => 67, 'item_worth' => 15]);
     //  $cause = Cause::where('cause_title',
     //  	'Flood Donation PK')->get()->first();
     //  Item::create([
     //  	'cause_id' => $cause->cause_id,
     //  	'item_name' => 'blanket',
     //  	'item_description' => 'for flood donation',
     //  	'item_required' => 500,
     //  	'item_received' => 322,
     //  	'item_worth' => 12
     // ]);
     // Item::create([
     // 	'cause_id' => $cause->cause_id,
     //  	'item_name' => 'clothes',
     //  	'item_description' => 'for flood donation',
     //  	'item_required' => 900,
     //  	'item_received' => 545,
     //  	'item_worth' => 15
     // ]);
     //  $cause = Cause::where('cause_title',
     //  	'Earthquake PK')->get()->first();
     //  Item::create([
     //  	'cause_id' => $cause->cause_id,
     //  	'item_name' => 'cash',
     //  	'item_description' => 'for earthquake',
     //  	'item_required' => 500000,
     //  	'item_received' => 123410,
     //  	'item_worth' => 1
     // ]);
     // Item::create([
     // 	'cause_id' => $cause->cause_id,
     //  	'item_name' => 'clothes',
     //  	'item_description' => 'for earthquake',
     //  	'item_required' => 100,
     //  	'item_received' => 67,
     //  	'item_worth' => 15
     // ]);
 }
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');
// Route::post('/auth/login', 'MyAuthController@postLogin');
Route::get('/auth/logout', 'MyAuthController@getLogout');
Route::post('/auth/login', 'MyAuthController@postLogin');
Beispiel #4
0
 public function index($id)
 {
     $causes = Cause::where('organisation_id', $id)->get();
     return view('cause.causes')->with(array('causes' => $causes, 'id' => $id));
 }