mardi 28 mars 2017

BadMethodCallException in Controller.php line 82: Method [all] does not exist in laravel

Model code is below listed

?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class monthlyActivity extends Model
{
    protected $table = 'monthly_activities';
}

and controller is namespace App\Http\Controllers;

use Illuminate\Http\Request;

class monthlyActivity extends Controller
{
    //

    public function show()
    {
        $monthly = monthlyActivity::all();
        return view('show',['monthly' => $monthly]);
    }
}

show.blade file is below

<tbody>
                <?php
                foreach($monthly as $mon)
                {
                        ?>
                        <tr>
                            <td>
                            <?php echo $mon->id ?>
                            </td>
                            <td>
                            <?php echo $mon->year ?>
                            </td><td>
                            <?php echo $mon->id ?>
                            </td>
                            <td>
                            <?php echo $mon->id ?>
                            </td><td>
                            <?php echo $mon->id ?>
                            </td><td>
                            <?php echo $mon->id ?>
                            </td><td>
                            <?php echo $mon->id ?>
                            </td>
                        </tr>

                        <?php

                }
                ?>

in route file below is the mention route for this particular page

Route::get('show', 'monthlyActivity@show');

and am getting the error in all which is declare in controller, i don't know how can i solve this error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire