- ErrorException in d2b6780d094fcd76d73886545e91d2f26897f279.php line 12: Trying to get property of non-object (View: C:\wamp\www\laravel\pmaneger\resources\views\companies\show.blade.php)
CompaniesController.php
-
namespace App\Http\Controllers; use App\Company; use Illuminate\Http\Request;
use App\Http\Requests;
class CompaniesController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // //list of all companies
$companies = Company::all(); return view('companies.index', ['companies'=> $companies]);//b2alb lresource/view/new folder/mne3ml companies file/b2alb companies /new file (index)
} /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Company $company) { // //$company = Company::where('id', $company->id )->first(); //OR $company = Company::find($company->id); return view('companies.show', ['company' => $company]); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // }}
Show.blade.php
-
@extends('layouts.app') @section('content')
<!-- The justified navigation menu is meant for single line per list item. Multiple lines will require custom code not provided by Bootstrap. --> <!-- Jumbotron --> <div class="jumbotron"> <h1> </h1> <p class="lead"> </p> </div> <!-- Example row of columns --> <div class="row"> <div class="col-lg-4"> <h2>Safari bug warning!</h2> <p class="text-danger">As of v9.1.2, Safari exhibits a bug in which resizing your browser horizontally causes renderingerrors in the justified nav that are cleared upon refreshing.
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
View details »
</div> </div> @endsection
routes.php
-
/* |-------------------------------------------------------------------------- | 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::get('/', function () { return view('welcome'); });
Route::auth(); //Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::resource('companies', 'CompaniesController'); Route::resource('projects', 'ProjectsController'); Route::resource('roles', 'RolesController'); Route::resource('task', 'TasksController'); Route::resource('users', 'UsersController');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire